#include <bits/stdc++.h>
using namespace std;
const int VX[] = {0, 1, 0, -1};
const int VY[] = {1, 0, -1, 0};
const long MOD = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, a_max = 0, a_min = INT_MAX;
  cin >> n;
  for (int i = (0); i < (n); i++) {
    cin >> a;
    if (a > a_max) a_max = a;
    if (a < a_min) a_min = a;
  }
  cout << a_max - a_min << "\n";
  return 0;
}
