#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[111] = {0}, b[111] = {0};
  int k = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int d;
    cin >> d;
    if (b[d] == 0) {
      a[k] = d;
      k++;
      b[d] = 1;
    }
  }
  sort(a, a + k);
  int res = 0;
  for (int i = 1; i < k; i++) {
    int t = a[i] - a[i - 1];
    res += t;
  }
  cout << res;
}
