#define _GLIBCXX_DEBUG #include #define rep(i, n) for (int i = 0; i < (int)n; i++) #define repp(i, m, n) for (int i = (int)m; i < (int)n; i++) #define all(v) begin(v), end(v) using namespace std; using ll = long long int; int N, X[1000001] = {0}; int main() { // 入力 cin >> N; rep(i, N) { int x; cin >> x; X[x]++; } // 点 vector v; rep(i, 1000001) if (X[i] != 0) v.push_back(i); // 出力 if (v.size() == 1) cout << 0 << endl; else { int Min = 10000000; for (int i = 0; i < v.size() - 1; i++) Min = min(Min, v[i + 1] - v[i]); cout << Min << endl; } }