N, *X = map(int, open(0).read().split()) X = sorted(set(X)) print(min((b - a for a, b in zip(X, X[1:])), default=0))