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