#include <bits/stdc++.h>
int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);
int main(void) {
  int N, a[101], i, tmp = 0;
  scanf("%d", &N);
  i_cins(N, a);
  if (N == 1) {
    printf("%d\n", a[0]);
    return 0;
  }
  qsort((void*)a, N, sizeof(a[0]), s_asort);
  printf("%d\n", a[N - 1] - a[0]);
  return 0;
}
int s_dsort(const void* a, const void* b) { return (*(int*)b - *(int*)a); }
int s_asort(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
int l_cins2(int n, long* a, long* b) {
  int i;
  for (int i = 0; i < n; i++) {
    scanf("%ld %ld", &*(a + i), &*(b + i));
  }
  return 0;
}
int i_cins(int n, int* a) {
  int i;
  for (int i = 0; i < n; i++) {
    scanf("%d", &*(a + i));
  }
  return 0;
}
