#include <bits/stdc++.h>
using namespace std;
int a[1005] = {0};
int main() {
  int i, n, t, s;
  while (scanf("%d", &n) != -1) {
    for (i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a, a + n + 1);
    t = 0;
    s = a[3] - a[1];
    for (i = 2; i <= n; i++) {
      t = max(t, a[i] - a[i - 1]);
      if (i >= 3) s = min(s, a[i] - a[i - 2]);
    }
    int ans = max(s, t);
    printf("%d\n", ans);
  }
  return 0;
}
