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