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