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