#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    vector<int> hou(n);
    for(int i=0;i<n;i++){
      cin>>house[i];
    }
  sort(hou.begin(),hou.end());
  cout<<hou[n-1]-hou[0]<<endl;
}
