#include #include using namespace std; int main(int argc, const char* argv[]) { int N; cin >> N; int X[N]; for (auto&& x : X) cin >> x; sort(X, &X[N]); int defval = (int)1e6 + 1; int minGap = defval; for (int i = 1; i < N; i++) { int gap = abs(X[i] - X[i - 1]); if (gap > 0) minGap = min(minGap, gap); } cout << (minGap != defval ? minGap : 0) << endl; return 0; }