#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  vector<int> pos(N);
  for (int i = 0; i < N; i++) {
    cin >> pos[i];
  }
  int a, b;
  int max, min;
  for (int i = 0; i < N; i++) {
    if (max < pos[i]) max = pos[i];
  }
  min = max;
  for (int i = 0; i < N; i++) {
    if (pos[i] < min) min = pos[i];
  }
  cout << max - min << endl;
}
