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