#include<bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long
#define se second
#define fi first
#define be begin()
#define en end()
#define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int main()
{
Faster;
int n; cin >> n;
int a[n];
for(auto &x : a) cin >> x;
int ans = INT_MIN, id1, id2;
for(int i = 1; i < n; i++)
{
if(ans < a[i] - a[i-1])
{
ans = a[i] - a[i-1];
id1 = i-1;
id2 = i;
}
}
for(int i = 2; i < n; i++)
{
if(ans < a[i] - a[i-2])
{
ans = a[i] - a[i-2];
id1 = i - 2;
id2 = i;
}
}
cout << ans;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBlbCAiXG4iCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgdWxsIHVuc2lnbmVkIGxvbmcgbG9uZwojZGVmaW5lIHNlIHNlY29uZAojZGVmaW5lIGZpIGZpcnN0CiNkZWZpbmUgYmUgYmVnaW4oKQojZGVmaW5lIGVuIGVuZCgpCiNkZWZpbmUgRmFzdGVyIGNpbi50aWUoMCk7IGNvdXQudGllKDApOyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOwoKaW50IG1haW4oKQp7CiAgICBGYXN0ZXI7CiAgICBpbnQgbjsgY2luID4+IG47CiAgICBpbnQgYVtuXTsKICAgIGZvcihhdXRvICZ4IDogYSkgY2luID4+IHg7CiAgICBpbnQgYW5zID0gSU5UX01JTiwgaWQxLCBpZDI7CiAgICBmb3IoaW50IGkgPSAxOyBpIDwgbjsgaSsrKQogICAgewogICAgICAgIGlmKGFucyA8IGFbaV0gLSBhW2ktMV0pCiAgICAgICAgewogICAgICAgICAgICBhbnMgPSBhW2ldIC0gYVtpLTFdOwogICAgICAgICAgICBpZDEgPSBpLTE7CiAgICAgICAgICAgIGlkMiA9IGk7CiAgICAgICAgfQogICAgfQogICAgZm9yKGludCBpID0gMjsgaSA8IG47IGkrKykKICAgIHsKICAgICAgICBpZihhbnMgPCBhW2ldIC0gYVtpLTJdKQogICAgICAgIHsKICAgICAgICAgICAgYW5zID0gYVtpXSAtIGFbaS0yXTsKICAgICAgICAgICAgaWQxID0gaSAtIDI7CiAgICAgICAgICAgIGlkMiA9IGk7CiAgICAgICAgfQogICAgfQogICAgY291dCA8PCBhbnM7CiAgICByZXR1cm4gMDsKfQo=