#include <stdio.h>
#include <stdlib.h>

int compar(const int *val1,const int *val2){
    return *val1-*val2;
}

int main(void){
    int n,map[1000],i,min;
    for(;min=1000001,scanf("%d",&n),n;){
        for(i=0;i<n;i++)
            scanf("%d",&map[i]);
        qsort(map,n,sizeof(int),(int (*)(const void *,const void *))compar);
        for(i=0;i<n-1;i++){
            if(min > map[i+1]-map[i])
                min=map[i+1]-map[i];
        }
        printf("%d\n",min);
    }
    return 0;
}