#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> xs(N);
  for (int i = 0; i < N; i++) cin >> xs[i];
  sort(xs.begin(), xs.end());
  cout << xs[N - 1] - xs[0] << endl;
  return 0;
}
