#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n - 1], now, prev, max = -1;
  cin >> prev;
  for (int i = 1; i < n; i++) {
    cin >> now;
    a[i - 1] = now - prev;
    if (a[i - 1] > max) max = a[i - 1];
    prev = now;
  }
  int allGreaterThanMax = 1, min = INT_MAX;
  for (int i = 0; i < n - 2; i++) {
    if (a[i] + a[i + 1] <= max) {
      allGreaterThanMax = 0;
      break;
    } else if (a[i] + a[i + 1] < min)
      min = a[i] + a[i + 1];
  }
  if (allGreaterThanMax)
    cout << min;
  else
    cout << max;
}
