#include #include #define ArraySize 1000001 int main(void){ int Array1[ArraySize]; int Array2[ArraySize]; for(int i = 0;i < ArraySize;i++){ Array1[i] = -1; Array2[i] = -1; } int n = 0; int x = 0; int k = 0; int y = 1000000; scanf("%d", &n); for(int j = 0;j < n;j++){ scanf("%d", &x); for(int i = 0;i < ArraySize;i++){ if(i == x){ Array1[i] = x; } } } for(int i = 0;i < ArraySize;i++){ if(Array1[i] != -1){ Array2[k] = Array1[i]; k++; } } if(k==1){ printf("0\n"); return 0; } for(int i = k-1;i > 0;i--){ if(Array2[i]-Array2[i-1] < y){ y = Array2[i]-Array2[i-1]; } } printf("%d\n", y); return 0; }