// AOJ 1608: Selection of Participants of an Experime...
// 2017.10.6 bal4u@uu

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

int a[1002];

int cmp(int *a, int *b) { return *a - *b; }

int main()
{
	int n, i, ans;

	while (scanf("%d", &n) && n > 0) {
		for (i = 0; i < n; i++) scanf("%d", a+i);
		qsort(a, n, sizeof(int), cmp);
		ans = a[1] - a[0];
		for (i = 2; i < n; i++) if (a[i] - a[i-1] < ans) ans = a[i] - a[i-1];
		printf("%d\n", ans);
	}
	return 0;
}