#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N + 1);
  for (int i = 0; i < N + 1; i++) cin >> a[i];
  int minv, maxv, lengs;
  sort(a.begin(), a.end());
  lengs = a.size();
  minv = a.at(0);
  maxv = a.at(N - 1);
  cout << maxv - minv << endl;
}
