#include #include #include #include #include #include using namespace std; int main() { int n; cin >> n; vector x; x.resize(n); for (int i = 0; i < n; i++) { cin >> x[i]; } sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()),x.end()); if (x.size() == 1) { cout << 0 << endl; return 0; } int mn=1000000; int pre; pre = x[0]; for (int i = 1; i < x.size(); i++) { mn = min(mn, x[i] - pre); pre = x[i]; } cout << mn << endl; return 0; }