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