#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a, ma = 1000, mi = 0;
  while (cin >> a) {
    ma = max(ma, a);
    mi = min(mi, a);
  }
  cout << ma - mi << endl;
}
