#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, k, r;
  d = 0;
  r = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 1; i++) {
    if ((a[i + 1] - a[i]) > d) {
      d = a[i + 1] - a[i];
      k = i;
    }
  }
  int j = 1;
  r = a[j + 1] - a[j - 1];
  j++;
  while (j < n - 1) {
    if ((a[j + 1] - a[j - 1]) < r) r = a[j + 1] - a[j - 1];
    j++;
  }
  if (r > d)
    cout << r;
  else
    cout << d;
  return 0;
}
