#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int amin = 1000, amax = 0, a;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    if (a > amax)
      amax = a;
    else if (a < amin)
      amin = a;
  }
  printf("%d", amax - amin);
}
