#include #include #include #define INT_MAX 2147483647 #define rep(i, n) for(int i = 0; i < (int)(n); i++) using namespace std; int main() { int N,min=INT_MAX; cin >> N; vector x(N); rep(i, N) { cin >> x[i]; } sort(x.begin(),x.end()); if (N <= 1) { cout << 0 << endl; return 0; } int count=0; for (int i = 1; i < N; i++) { if (abs(x[i] - x[i - 1]) < min && abs(x[i]-x[i-1])!=0) { min = abs(x[i] - x[i - 1]); } if (x[i] == 0) { count++; } } if (count == N) cout << 0; else cout << min; }