#include<stdio.h>
#define N 10001
#define M 100

int main()
{
  int i, j, n;
  int a[N];
  int sa[M][M];
  int temp;

  while(1)
    {
      
      scanf("%d",&n);

      if(n==0)
	return 0;
      else
	{
	  /*printf("n = %d\n",n);*/
	  
	  for(i=0;i<n;i++)
	    {
	      scanf("%d",&a[i]);
	      /*printf("%d = %d\n",i,a[i]);*/
	    }
	  
	  temp = 0;
	  
	  for(i=0;i<n;i++)
	    {
	      for(j=i+1;j<n;j++)
		{
		  sa[i][j] = a[i] - a[j];
		  if(sa[i][j]<0)
		    {
		      sa[i][j] = (-1)*sa[i][j];
		    }
		  if(j==1 || temp>sa[i][j])
		    {
		      temp = sa[i][j];
		    }
		}
	    }
	  printf("%d\n",temp);
	}
    }
  return 0;
}