#include <bits/stdc++.h>
using namespace std;
long long a[200000];
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  long long n;
  cin >> n;
  long long last1 = -1, last2 = -1, mr = 101111111111111, mrp = 0;
  for (long long i = 0; i < n; i++) {
    long long q;
    cin >> q;
    a[i] = q;
    if (i > 1) {
      if (q - last2 < mr) {
        mrp = i;
        mr = q - last2;
      }
    }
    last2 = last1;
    last1 = q;
  }
  long long res = -101111111111111;
  for (long long i = n - 1; i >= 1; i--) {
    if (i == mrp) {
      res = max(res, mr);
      i -= 2;
    }
    if (i < 1) break;
    res = max(res, a[i] - a[i - 1]);
  }
  cout << res;
}
