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

int comp(const void *a, const void *b)
{
	return *(int *)a - *(int *)b;
}

int main()
{
	int n;
	unsigned int min;
	int a[1000];
	while (scanf("%d", &n) && n) {
		min = -1;
		for (int i = 0; i < n; i++)
			scanf("%d", &a[i]);
		qsort(a, n, sizeof(int), comp);
		for (int i = 0; i < n - 1; i++)
			if (min > a[i + 1] - a[i])
				min = a[i + 1] - a[i];
		printf("%u\n", min);
	}
	return 0;
}

