#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, N, coodinates[1100];
  int maxcoodinate = 0;
  int mincoodinate = 0;
  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> coodinates[i];
  }
  for (i = 0; i < N; i++) {
    if (coodinates[i] <= mincoodinate) {
      mincoodinate = coodinates[i];
    }
    if (coodinates[i] >= maxcoodinate) {
      maxcoodinate = coodinates[i];
    }
  }
  cout << maxcoodinate - mincoodinate << endl;
  return 0;
}
