#include <iostream>
using namespace std;

int main() {
    int n;
    cin>>n;
    int MAX=0;
    int MIN=10000;
    while(n--){
      int x;
      cin>>x;
      if(x>=MAX)MAX=x;
      if(x<=MIN)MIN=x;
    }
    cout<<MAX-MIN<<endl;
    return 0;
   
}
// 64 位输出请用 printf("%lld")