#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
int N, in;
vector<int> a;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> in;
    a.push_back(in);
  }
  sort(a.begin(), a.end());
  cout << a[N] - a[0] << endl;
  return 0;
}
