#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n;
  vector<int> input;
  for (int r = 0; r < n; r++) {
    cin >> a;
    input.push_back(a);
  }
  vector<int>::iterator it = input.begin();
  vector<int>::iterator it1 = input.begin();
  advance(it1, 2);
  int diff[n - 2];
  for (int r = 0; r < n - 2; r++) {
    diff[r] = *it1 - *it;
    it1++;
    it++;
  }
  int dup[n - 2];
  for (int r = 0; r < n - 2; r++) {
    dup[r] = diff[r];
  }
  sort(dup, dup + (n - 2));
  int index;
  for (int r = 0; r < n - 2; r++) {
    if (diff[r] == dup[0]) {
      index = r + 1;
      break;
    }
  }
  vector<int>::iterator it2 = input.begin();
  advance(it2, index);
  input.erase(it2);
  vector<int>::iterator _it = input.begin();
  vector<int>::iterator _it1 = input.begin();
  advance(_it1, 1);
  int diff1[n - 2];
  for (int r = 0; r < n - 2; r++) {
    diff1[r] = *_it1 - *_it;
    _it1++;
    _it++;
  }
  sort(diff1, diff1 + (n - 2));
  cout << diff1[n - 3];
  return 0;
}
