#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> s;
  set<int>::iterator it;
  set<int>::iterator ite;
  int b, e, n, x, maxi = 0, mini = 10000000, d;
  cin >> n;
  while (n--) {
    cin >> x;
    s.insert(x);
  }
  it = s.begin();
  b = *it;
  ite = s.end();
  ite--;
  e = *ite;
  int i = 0;
  for (ite = s.begin(); *ite != e; ++ite) {
    if (*ite != b) {
      i++;
      x = *ite;
      s.erase(ite);
      maxi = 0;
      for (it = s.begin(); *it != e; ++it) {
        d = *++it;
        d -= *--it;
        maxi = max(maxi, d);
      }
      mini = min(mini, maxi);
      s.insert(x);
    }
  }
  cout << mini;
  return 0;
}
