#include #include #define SZ 1000000 using namespace std; bool X[SZ + 1]; int main() { int i, N, x, d = SZ + 1; cin >> N; for (i = 0; i < N; i++) X[cin >> x, x] = true; vector p; for (i = 0; i <= SZ; i++) if(X[i]) p.push_back(i); if (p.size() <= 1) { cout << 0 << endl; return 0; } for (i = 0; i < p.size() - 1; i++) if (d > p[i + 1] - p[i]) d = p[i + 1] - p[i]; cout << d << endl; return 0; }