#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=l;i<r;i++)
#define min(p,q)((p)<(q)?(p):(q))
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}

ll a[1010];
int main(){
	ll n;
	while(scanf("%lld",&n),n){
		rep(i,0,n)scanf("%lld",a+i);
		sortup(a,n);
		ll m=1000000;
		rep(i,0,n-1)m=min(m,a[i+1]-a[i]);
		printf("%lld\n",m);
	}
}
