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