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