#include<iostream>
#include<algorithm>

using namespace std;

int main(void)
{
  int n; cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  
  int mx=*max_element(a.begin(),a.end());
  int mi=*min_element(a.begin(),a.end());
  
  cout<<mx-mi<<endl;
  return 0;
}