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