#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
  int N;
  cin>>N;
  
  vector<int> vec[N];
  for(int i=0;i<N;++i){
    cin>>vec[i];
  }
  
  sort(vec.begin(),vec.end());
  
  cout<<vec[N-1]-vec[0]<<endl;
}
