#include using namespace std; int main() { int N; int X[100000]; 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 = i + 1; j < N; j++) { if (X[i] != X[j]) min[1] = X[j] - X[i]; if (min[1] < 0) min[1] *= -1; if (min[1] < min[0]) min[0] = min[1]; } } if (min[0] > 1000000) min[0] = -1; cout << min[0] << endl; }