#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 2];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int maxDist = INT_MIN;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      maxDist = max(maxDist, abs(a[i] - a[j]));
    }
  }
  cout << maxDist << endl;
  return 0;
}
