#include using namespace std; int main() { int N; int X[100000]; int swap; int min[2] = { 1000001,0 }; cin >> N; for (int i = 0; i < N; i++) cin >> X[i]; for (int i = 0; i < N - 1; i++) { for (int j = N - 1; j > i; j--) { if (X[j] < X[j - 1]) { swap = X[j - 1]; X[j - 1] = X[j]; X[j] = swap; } } } for (int i = 1; i < N; i++) { if (X[i] != X[i - 1]) min[1] = X[i] - X[i - 1]; if (min[1] < 0) min[1] *= -1; if (min[1] < min[0]) min[0] = min[1]; if (min[0] == 1) break; cout << i << endl; } if (min[0] > 1000000) min[0] = -1; cout << min[0] << endl; }