#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, a, mi = -1, ma = 100000;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    if (mi > a) mi = a;
    if (ma < a) ma = a;
  }
  cout << ma - mi << endl;
}
