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