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