#include <bits/stdc++.h>
using namespace std;

int main(void){
  
  int N;
  cin >> N;
  int data[N];
  for(int i=0;i<N;i++) cin >> data[i];
  sort(data,data+N);
  cout << data[N-1] - data[0] << endl;
}
