#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a;
  int amax = 0, amin = 0;
  cin >> N;
  cin >> amin;
  for (int i = 1; i < N; i++) {
    cin >> a;
    if (amin > a) amin = a;
    if (amax < a) amax = a;
  }
  cout << amax - amin << endl;
  return 0;
}
