#include #include #define MAX 1000001 int comp(const void *arg1, const void *arg2) { return *(int *)arg1 - *(int *)arg2; } int main() { int n, x[100000], d, min = MAX, i; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &x[i]); } qsort(x, n, sizeof(int), comp); for (i = 1; i < n; i++) { d = x[i] - x[i - 1]; if (d < min && d > 0) min = d; } if (min == MAX) min = 0; printf("%d\n", min); return 0; }