#include using namespace std; int X[100000]; int main() { int N; cin>>N; if (N == 1) { cout << 0 << endl; return 0; } sort(X, X+N); for (int i = 0; i < N; ++i) cin >> X[i]; int mi = 1e9; for (int i = 0; i < N - 1; ++i) { if (X[i]!=X[i+1]) mi = min(mi,abs(X[i+1]-X[i])); } cout << mi << endl; }