#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int max = -1;
  int min = 1001;
  for(i = 0; i < n; i++){
    int a;
    cin >> a;
    if(a > max) max = a;
    if(a < min) min = a;
  }
  cout << max-min << endl;
}
