#include #define F(i,n) for(int i = 0;i < n;i++) #define N 1000001 void z(int a[],int n,int min,int max){int s = a[(min+max)/2];int min2=min; int max2=max;int tmp;for(;;){for(;;){if(a[min2]>=s)break;min2++;}for(;;){if(a[max2]<=s)break;max2--;}if(min2>=max2)break;tmp=a[min2];a[min2]=a[max2];a[max2]=tmp;min2++;max2--;}if(minmax2+1) z(a,n,max2+1,max);} int main(void){ int n,t,r=N; scanf("%d",&n); int a[n]; F(i,n)scanf("%d",&a[i]); z(a,n,0,n); F(i,n){ t=a[i]-a[i+1]; if(t!=0){ if(t<0)t*=-1; if(r>t){ r=t; } } } if(r==N)puts("0"); else printf("%d\n",r); return 0; }