#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, l, k;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> k;
    m = max(m, k);
    l = min(l, k);
  }
  cout << m - l << endl;
  return 0;
}
