#include <bits/stdc++.h>
using namespace std;
int n, a[100], maks = 0, mins = 1000;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] > maks) maks = a[i];
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] < mins) mins = a[i];
  }
  cout << maks - mins << endl;
}
