#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include using namespace std; using Int = long long; //using namespace boost::multiprecision; const double EPS = 1e-10; long long const MOD = 998244353; long long mod_pow(long long x, long long n) { long long res = 1; for (int i = 0;i < 60; i++) { if (n >> i & 1) res = res * x % MOD; x = x * x % MOD; } return res; } template T gcd(T a, T b) { return b != 0 ? gcd(b, a % b) : a; } template T lcm(T a, T b) { return a * b / gcd(a, b); } void fastInput() { cin.tie(0); ios::sync_with_stdio(false); } int main(void) { int N; cin >> N; vector X(N); for (int i = 0; i < N; i++) { cin >> X[i]; } sort(X.begin(), X.end()); X.erase(unique(X.begin(), X.end()), X.end()); int ans = 1000005; for (int i = 1; i < X.size(); i++) { ans = min(abs(X[i] - X[i-1]), ans); } if (ans == 1000005) ans = 0; cout << ans << endl; }