#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int maxx = 0x3f3f3f3f, minn = -1;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    maxx = max(maxx, a);
    minn = max(minn, a);
  }
  cout << maxx - minn << endl;
}
