/*
 * Copyright (C) 2016 Hiroyasu Kamo
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

/*
 * ACM-ICPC 2016 Japan Domestic Contest
 *  Problem A  Selection of Participants of an Experiment
 *
 *	Author: Hiroyasu Kamo <wd@ics.nara-wu.ac.jp>
 */

#include <algorithm>
#include <limits>
#include <set>
#include <iostream>
using std::multiset;
using std::cin;
using std::cout;
using std::endl;

int
main()
{
	for (int n; cin >> n && n > 0; ) {
		multiset<int>	a;
		for (int i = 0; i < n ; i ++) {
			int	x;
			cin >> x;
			a.insert(x);
		}
		int	diff = std::numeric_limits<int>::max();
		auto	p = a.cbegin();
		int	prev = *p;
		for (++ p; p != a.cend(); ++ p) {
			const int	d = *p - prev;
			prev = *p;
			if (diff > d) {
				diff = d;
			}
		}
		cout << diff << endl;
	}
	return 0;
}
