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