#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int max;
  int min2;
  vector<int> holds;
  int current;
  for (int i = 0; i < n; i++) {
    cin >> current;
    holds.push_back(current);
  }
  max = holds[1] - holds[0];
  min2 = holds[2] - holds[0];
  for (int i = 0; i < n - 1; i++) {
    int diff = holds[i + 1] - holds[i];
    if (diff > max) {
      max = diff;
    }
    int cmin = holds[i + 2] - holds[i];
    if (i < n - 2 && cmin < min2) {
      min2 = cmin;
    }
  }
  cout << (min2 > max ? min2 : max);
  return 0;
}
