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