#include<stdio.h>

 
int main()
{
    int n, i, j, sum, min, a[1000];
     
    while(scanf("%d",&n))
    {
        if(n==0)
            break;
        else
        {
            for(i=0;i<n;i++)
                scanf("%d",&a[i]);
            min = 1000000;
            for(i=0;i<n-1;i++)
            {
                for(j=i+1;j<n;j++)
                {
                    sum = a[i]-a[j];
                    if(sum<0)
                        sum = sum * (-1);
                    if(min>sum)
                        min = sum;
                }
            }
            printf("%d\n",min);
        }
    }
    return 0;
}
