#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 0; i + 1 < n; i++) {
    ans = max(ans, a[i + 1] - a[i]);
  }
  long long m = INT_MAX;
  for (long long i = 0; i + 2 < n; i++) {
    m = min(m, max(a[i + 2] - a[i], ans));
  }
  cout << m;
  return 0;
}
