#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n], maxv = 0, minv = 10;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > maxv) maxv = a[i];
    if (a[i] < minv) minv = a[i];
  }
  cout << maxv - minv << endl;
  return 0;
}
