#include <bits/stdc++.h>
int inf = 1000000007;
using namespace std;
int main() {
  int n;
  cin >> n;
  int mn = 0;
  int mx = 1000;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    mx = max(mx, a);
    mn = min(mn, a);
  }
  cout << mx - mn << endl;
  return 0;
}
