#include using namespace std; typedef long long ll; typedef string str; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; ll temp, nmin = LONG_MAX; for (ll i = 0; i < n; i++) { ll x; cin >> x; if (i == 0) temp = x; else { if (temp == x) nmin = min(nmin, 1LL); else nmin = min(nmin, max(temp, x) - min(temp, x)); temp = x; } } cout << nmin; return 0; }