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