#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, i;
  cin >> n;
  long long int a[n + 0];
  for (long long int hh = 0; hh < n + 0; hh++) cin >> a[hh];
  ;
  long long int mx = 0, mn = LLONG_MAX;
  for (long long int x : a) mx = max(mx, x), mn = min(mn, x);
  cout << mx - mn;
  return 0;
}
