#include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n, t; vector v; cin >> n; for (int i = 0; i < n; i++) { cin >> t; v.push_back(t); } sort(v.begin(), v.end()); int res = 1e9; for (int i = 1; i < n - 1; i++) { if (v[i - 1] != v[i]) { res = min(res, abs(v[i] - v[i - 1])); } if (v[i + 1] != v[i]) { res = min(res, abs(v[i] - v[i + 1])); } } if(res>=1e9) res = 0; cout << res << '\n'; return 0; }