#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int c[n];
  int b = INT_MAX;
  int s = INT_MIN;
  cin >> n;
  for (int i = 0; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i <= n; i++) {
    b = min(b, c[i]);
    s = max(s, c[i]);
  }
  cout << s - b << endl;
  return 0;
}
