# yukicoder No.135 とりあえず1次元の問題 N = int(input()) X = [int(x) for x in input().split()] M = 10 ** 6 min_d = M + 1 X.sort() for i in range(N): if i > 0: d = X[i] - X[i - 1] if d > 0: min_d = min(d, min_d) print(min_d if min_d <= M else 0)