#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a;
  cin >> a;
  int ara[a], b;
  b = a - 1;
  for (int i = 1; i < a; i++) cin >> ara[i];
  sort(ara, ara + a);
  cout << ara[b] - ara[0] << "\n";
  return 0;
}
