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