#include #include int asc(const void *a, const void *b) { return *(int*)a - *(int*)b; } int main(void) { int N, X[100000]; int i, j, min = 0, temp; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%d", &(X[i])); } qsort(X, N, sizeof(int), asc); min = 1000001; for (i = 0; i < N - 1; i++) { if (X[i] == X[i+1]) { continue; } else if (X[i] < X[i+1]) { temp = X[i+1] - X[i]; } else { temp = X[i] - X[i+1]; } if (min > temp) { min = temp; } } if (min != 1000001) { printf("%d\n", min); } else { printf("0\n"); } return 0; }