#include <bits/stdc++.h>
int main() {
  int i, N, max, min, ans;
  int a[30];
  max = 0;
  min = 1000;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < N; i++) {
    if (a[i] > max) {
      max = a[i];
    }
    if (a[i] < min) {
      min = a[i];
    }
  }
  ans = max - min;
  printf("%d\n", ans);
  return 0;
}
