#include<bits/stdc++.h>
#include<vector>
using namespace std;
int n, a;
int max = -1;
int min = 1001;
int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a;
    if(min > a) min = a;
    if(max < a) max = a;
  }
  cout << max - min << endl;
}