#include <bits/stdc++.h>
int main() {
  int n, i, c, p, d, pd, max = 0, mind = 1000;
  scanf("%d", &n);
  scanf("%d", &c);
  scanf("%d", &p);
  pd = p - c;
  for (i = 2; i < n; i++) {
    scanf("%d", &c);
    d = c - p;
    if (max < d) max = d;
    if (mind > d + pd) mind = d + pd;
    pd = d;
    p = c;
  }
  if (mind > max) max = mind;
  printf("%d\n", max);
}
