#include <bits/stdc++.h>
using namespace std;
const int M = 0x3f3f3f;
int i, j;
int main() {
  int a[1005], b, c = M, d;
  int n, x, l, r, m;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  x = 0;
  for (i = 1; i < n; i++) x = max(a[i] - a[i - 1], x);
  for (i = 1; i < n - 1; i++)
    if (a[i + 1] - a[i - 1] < x) {
      cout << x;
      return 0;
    } else
      c = min(a[i + 1] - a[i - 1], c);
  cout << c;
}
