#include #include int comp(const void *a, const void *b){ return *(int*)a - *(int*)b; } int main(){ int n, a[100000], i, c=10000000; scanf("%d", &n); for(i = 0; i < n; i++) scanf("%d", &a[i]); qsort(a, n, sizeof(int), comp); for(i = 1; i < n; i++) if(a[i] != a[i-1] && a[i] - a[i-1] < c) c = a[i] - a[i-1]; if(c == 10000000) c = 0; printf("%d\n", c); return 0; }