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