#include <bits/stdc++.h>
int main() {
  int num;
  scanf("%d", &num);
  int iPos;
  int min = 1000;
  int max = 0;
  for (int i = 0; i < num; i++) {
    scanf("%d", &iPos);
    if (iPos < min)
      min = iPos;
    else if (iPos > max)
      max = iPos;
  }
  std::cout << max - min;
  return 0;
}
