#include <bits/stdc++.h>
using namespace std;
const int INF = 1234567890;
const long long INF_LL = LLONG_MAX - INF;
const int MAXN = 4e4;
const int MAXM = 1e4;
const int MOD = 1e9 + 7;
const double eps = 1e-6;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int maxi = 1;
  for (int i = 2; i < n; i++) {
    if (a[i] - a[i - 2] < a[maxi + 1] - a[maxi - 1]) {
      maxi = i - 1;
    }
  }
  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (maxi != i - 1) {
      ans = max(ans, a[i] - a[i - 1]);
    } else {
      ans = max(ans, a[i] - a[i - 2]);
    }
  }
  cout << ans << endl;
}
