#include #define uniq(xs) ((xs).erase(unique((xs).begin(), (xs).end()), (xs).end())) using namespace std; namespace { typedef double real; typedef long long ll; template ostream& operator<<(ostream& os, const vector& vs) { if (vs.empty()) return os << "[]"; os << "[" << vs[0]; for (int i = 1; i < vs.size(); i++) os << " " << vs[i]; return os << "]"; } template istream& operator>>(istream& is, vector& vs) { for (auto it = vs.begin(); it != vs.end(); it++) is >> *it; return is; } int N; vector X; void input() { cin >> N; X.resize(N); cin >> X; } const int INF = INT_MAX; void solve() { int ans = INF; sort(X.begin(), X.end()); uniq(X); for (int i = 0; i < N - 1; i++) { ans = min(ans, abs(X[i] - X[i + 1])); } if (ans == INT_MAX) { cout << 0 << endl; return; } cout << ans << endl; } } int main() { input(); solve(); return 0; }