#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int ma = 0;
  int mi = 1001;
  for (int i = 0; i < a; i++) {
    int b[100];
    cin >> b[i];
    int ma = max(ma, b[i]);
    int mi = min(mi, b[i]);
  }
  cout << ma - mi << endl;
}
