#include<iostream>
using namespace std;

int main(){
  int N,min,max;
  max = 0;
  min = 1000;
  cin >> N;
  long a[N];
  for(int i=0;i<N;i++){
    cin >> a[i];
    min = min(a[i],min);
    max = max(a[i],max);
  }
  cout << max-min << endl;
  return 0;
}