#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int p = n;
  for (int j = 0; j < n; j++) {
    if (a[j] < p) p = a[j];
  }
  int q = 0;
  for (int e = 0; e < n; e++) {
    if (a[e] > q) q = a[e];
  }
  cout << q - p << endl;
}
