#include <bits/stdc++.h>
using namespace std;
const int MAX_n = 100;
int n, a[MAX_n];
signed main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int mi = 100000000;
  int ma = 0;
  for (int i = 0; i < n; i++) {
    if (a[n] > ma) {
      ma = a[n];
    }
    if (a[n] < mi) {
      mi = a[n];
    }
  }
  printf("%d\n", ma - mi);
  return 0;
}
