#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  int64_t a[100001], b[100001], c, d, e, f, m, n, p, x, y, z, t, i, j, k;
  cin >> t;
  for (i = 0; i < t; i++) {
    cin >> a[i];
  }
  c = *max_element(a, a + t);
  d = *min_element(a, a + t);
  cout << c - d << "\n";
}
