/*
 * 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
 *
 *  slow
 *
 *	Author: Hiroyasu Kamo <wd@ics.nara-wu.ac.jp>
 */

#include <cstdlib>
#include <limits>
#include <vector>
#include <iostream>
using std::abs;
using std::vector;
using std::cin;
using std::cout;
using std::endl;

int
main()
{
	for (int n; cin >> n && n > 0; ) {
		vector<int>	a;
		for (int i = 0; i < n ; i ++) {
			int	x;
			cin >> x;
			a.push_back(x);
		}
		int	diff = std::numeric_limits<int>::max();
		for (int i = 1; i < n; i ++) {
			for (int j = 0; j < i; j ++) {
				const int	d = abs(a[i] - a[j]);
				if (diff > d) {
					diff = d;
				}
			}
		}
		cout << diff << endl;
	}
	return 0;
}
