#include <bits/stdc++.h>
using namespace std;
void i_sort(int *a, int n) {
  for (int i = 0; i < n; ++i) {
    int j = i;
    int tmp;
    while (j >= 0) {
      if (a[j] > a[j + 1]) {
        tmp = a[j];
        a[j] = a[j + 1];
        a[j + 1] = tmp;
      }
      --j;
    }
  }
}
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  int max, min;
  i_sort(a, n);
  cout << a[n - 1] - a[0] << endl;
}
