#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[n], m = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0) continue;
    if (a[i] - a[i - 1] > m) m = a[i] - a[i - 1];
  }
  int min = INT_MAX;
  int index;
  for (int i = 2; i < n; i++) {
    if (a[i] - a[i - 2] < min) {
      min = a[i] - a[i - 2];
      index = i - 1;
    }
  }
  int w = a[index + 1] - a[index - 1];
  if (w > m)
    cout << w << "\n";
  else
    cout << m << "\n";
  return 0;
}
