#include <bits/stdc++.h>
int main() {
  int large_n;
  int buf[100];
  std::cin >> large_n;
  for (int i = 0; i < (large_n); i++) {
    std::cin >> buf[i];
  }
  if (buf[(large_n - 1)] < 0 || buf[(large_n - 1)] > 1000) {
    std::cout << "Invalid lange!" << std::endl;
    return 1;
  }
  int max_zahyo = 0;
  int min_zahyo = 100;
  for (int i = 0; i < (large_n); i++) {
    if (buf[i] <= min_zahyo) {
      min_zahyo = buf[i];
    } else if (buf[i] >= max_zahyo) {
      max_zahyo = buf[i];
    }
  }
  std::cout << (max_zahyo - min_zahyo) << std::endl;
  return 0;
}
