#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, i, j, sub, data[1000];
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> data[i];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (data[i] > data[i + 1]) {
        x = data[i];
        data[i] = data[i + 1];
        data[i + 1] = x;
      }
    }
  }
  sub = data[n] - data[0];
  cout << sub << endl;
  return 0;
}
