#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[N];
  int min = 200;
  int max = -300;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (a[i] < min) {
      min = a[i];
    }
  }
  for (int j = 0; j < N; j++) {
    if (a[j] > max) {
      max = a[j];
    }
  }
  cout << max - min;
}
