#include #include #include using namespace std; int main(void) { int ans = 9999999999, n; cin >> n; vector v(n); for (int i = 0; i < n; i++){ cin >> v[i]; } sort(v.begin(), v.end()); for (int i = 0; i < n-1; i++){ if (v[i + 1] != v[i]){ int tmp = v[i + 1] - v[i]; if (tmp < ans){ ans = tmp; } } else ans = 0; } cout << ans << endl; return 0; }