#include #include #include #include #include #include using namespace std; const int INF = 1e9; template void show(T &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]; } // show(x); set y(x.begin(), x.end()); // show(y); int ans = INF; auto it = y.begin(); int prev = *it; it++; while (it != y.end()) { int diff = *it - prev; if (diff != 0) { ans = min(diff, ans); } prev = *it; it++; } if (ans == INF) { ans = 0; } cout << ans << endl; return 0; }