#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int min1 = 0;
  int max1 = 0;
  for (int i = 0; i < (N); ++i) {
    int x;
    cin >> x;
    ;
    max1 = max(x, max1);
    min1 = min(x, min1);
  }
  cout << max1 - min1 << endl;
}
