#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  int N;
  vector<int> A(N);
  for (long long i = 0; i < N; ++i) cin >> A[i];
  cout << *max_element(A.begin(), A.end()) - *min_element(A.begin(), A.end())
       << endl;
}
