import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) { stderr.writeln(arg); }
int size(T)(in T s) { return cast(int)s.length; }

void main() {
    bool solve() {
        int N; readf("%d\n", &N);
        if (N == 0) return false;
        auto A = readln.chomp.split(" ").map!(to!int).array;
        A.sort;
        int ans = int.max;
        foreach (i, e; A[0 .. $ - 1]) {
            int d = A[i + 1] - A[i];
            ans = min(ans, d);
        }
        writeln(ans);
        return true;
    }
    while (solve()) {}
}