#include using namespace std; int main() { int n; cin >> n; vector a(n); for (int &e : a) cin >> e; sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); int ans = (a.size() > 1 ? 1e9 : 0); for (int i = 0; i + 1 < a.size(); i++) { ans = min(ans, a[i + 1] - a[i]); } cout << ans << '\n'; return 0; }