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