#include <bits/stdc++.h>
using namespace std;
int a[100 + 10];
int b[100 + 10];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n == 3) {
    cout << a[2] - a[1] + a[1] - a[0];
  } else {
    int Max = 1000 + 10;
    for (int i = 1; i < n; i++) {
      b[i - 1] = a[i] - a[i - 1];
    }
    for (int i = 0; i < n - 2; i++) Max = min(Max, b[i] + b[i + 1]);
    sort(b, b + n - 1);
    if (b[n - 2] < Max) {
      cout << Max;
    } else
      cout << b[n - 2];
  }
  return 0;
}
