#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; } if (min > (X[i+1] - X[i])) { min = X[i+1] - X[i]; } } if (min != 1000001) { printf("%d\n", min); } else { printf("0\n"); } return 0; }