#include <bits/stdc++.h>
using namespace std;
const int N = 111;
const int INFI = 2147483627;
int a[N], b[N];
int main() {
  int n, ans = -1, flag, t;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) {
    b[i - 1] = a[i] - a[i - 1];
    if (ans < b[i - 1]) ans = b[i - 1];
  }
  flag = 0;
  t = INFI;
  for (int i = 0; i < n - 2; i++) {
    if (b[i] + b[i + 1] <= ans) {
      flag = 1;
      printf("%d\n", ans);
      break;
    }
    if (t > b[i] + b[i + 1]) t = b[i] + b[i + 1];
  }
  if (!flag) printf("%d\n", t);
  return 0;
}
