#include #include #include #include #include using namespace std; const int INF = 1e9; void show(vector &a) { for (auto it = a.begin(); it != a.end(); it++) { cout << *it << " "; } cout << endl; } int main() { int n; cin >> n; vector x(n); for (int i = 0; i < n; i++) { cin >> x[i]; } sort(x.begin(), x.end()); // show(x); // auto ret = unique(x.begin(), x.end()); // show(x); // x.erase(ret, x.end()); // show(x); x.erase(unique(x.begin(), x.end()), x.end()); int ans = INF; for (int i = 1; i < x.size(); i++) { int diff = x[i] - x[i - 1]; if (diff != 0) { ans = min(diff, ans); } } if (ans == INF) { ans = 0; } cout << ans << endl; return 0; }