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