#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; } for (int i = 1; i < N; i++) { if (abs(x[i] - x[i - 1]) < min && abs(x[i] - x[i - 1])) { min = abs(x[i] - x[i - 1]); } } cout << min; }