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