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