#include <bits/stdc++.h>
using namespace std;
int main() {
  int b, c, d, e;
  cin >> b;
  c = b;
  d = b;
  for (int i = 0; i < b; i++) {
    cin >> e;
    if (e > c) {
      c = e;
    } else if (e < d) {
      d = e;
    }
  }
  cout << c - d << endl;
  return 0;
}
