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