#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int num[105] = {0};
    for (int i = 0; i < n; i++) {
      cin >> num[i];
    }
    int t;
    int min = num[0], max = num[0];
    for (int i = 0; i < n; i++) {
      if (num[i] > max) {
        max = num[i];
      }
      if (min > num[i]) {
        min = num[i];
      }
    }
    cout << max - min << endl;
  }
  return 0;
}
