#include <bits/stdc++.h>
using namespace std;
int a[10005];
int main() {
  int n;
  cin >> n;
  int minn = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int ans = a[n - 1] - a[0];
  for (int i = 1; i < n - 1; i++) {
    int tem = a[i + 1] - a[i - 1];
    for (int j = 1; j < n; j++) {
      minn = max(minn, a[j] - a[j - 1]);
    }
    ans = min(ans, max(tem, minn));
  }
  cout << ans << endl;
  return 0;
}
