#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int exgcd(int a, int b, int &x, int &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  int r = exgcd(b, a % b, x, y);
  int t = y;
  y = x - a / b * y;
  x = t;
  return r;
}
inline int lcm(int a, int b) { return a / gcd(a, b) * b; }
inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a > b ? b : a; }
inline int abs(int a) { return a > 0 ? a : -a; }
bool leitu(int a, int &x, int b, int &y, int c) {
  int s, t;
  int GCD = exgcd(a, b, s, t);
  if (abs(c) % GCD) return false;
  int s0 = (-s) * c / GCD;
  int t0 = t * c / GCD;
  int B = b / GCD;
  int A = a / GCD;
  if (s0 >= 0 && t0 >= 0) {
    while (s0 - B >= 0 && t0 - A >= 0) {
      s0 -= B;
      t0 -= A;
    }
  } else {
    while (!(s0 >= 0 && t0 >= 0)) {
      s0 += B;
      t0 += A;
    }
  }
  x = s0;
  y = t0;
  return true;
}
const int maxn = 1010;
int a[maxn];
int main() {
  int n;
  cin >> n;
  int MAX = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i > 0) {
      if (a[i] - a[i - 1] > MAX) MAX = a[i] - a[i - 1];
    }
  }
  int MIN = 1010;
  for (int i = 0; i < n - 2; i++) {
    if (a[i + 2] - a[i] < MIN) {
      MIN = a[i + 2] - a[i];
    }
  }
  cout << max(MIN, MAX) << endl;
  return 0;
}
