#include #include int cmp(const void* n1, const void* n2) { if (*(int*)n1 > *(int*)n2) { return 1; } else if (*(int*)n1 < *(int*)n2) { return -1; } else { return 0; } } int main() { int N; scanf("%d", &N); int* X; X = (int*)malloc(sizeof(int) * N); for (int i = 0; i < N; i++) { scanf("%d", &X[i]); } qsort(X, N, sizeof(int), cmp); int* Y; Y = (int*)malloc(sizeof(int) * N); int min = X[N - 1]; if (X[0] == X[N - 1]) { printf("0"); return 0; } for (int i = 1; i < N; i++) { if (X[i - 1] == X[i]) { continue; } if (X[i] - X[i - 1] < min) { min = X[i] - X[i - 1]; } } printf("%d", min); return 0; }