#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int dif = 0;
  for (int i = 0; i < n - 1; i++) {
    if (dif < a[i + 1] - a[i]) {
      dif = a[i + 1] - a[i];
    }
  }
  int sdif = 1000;
  int pos = 0;
  for (int i = 0; i < n - 2; i++) {
    int pd = a[i + 2] - a[i];
    if (pd >= dif) {
      if (pd <= sdif) {
        sdif = pd;
      }
    } else {
      sdif = dif;
    }
  }
  cout << sdif << endl;
}
