#include #define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false)) #define MAX 1000000 using namespace std; int main() { fastIO; int n; cin >> n; if (n <= 1) { cout << 0 << '\n'; return 0; } vector ps(n); for (auto &p : ps) cin >> p; sort(ps.begin(), ps.end()); int minv = MAX + 1; for (size_t i = 0; i < ps.size() - 1; ++i) { int cur = ps[i], next = ps[i + 1]; if (cur != next) minv = min(abs(cur - next), minv); } // all points are same ? if (minv == MAX + 1) cout << 0 << '\n'; else cout << minv << '\n'; return 0; }