#include using namespace std; int main() { int N; cin >> N; vector x(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() >= 2) { int ans = 1e9; for (int i = 0; i < x.size()-1; ++i) { ans = min(ans, x[i+1]-x[i]); } cout << ans << endl; } else { cout << 0 << endl; } }