N = int(input()) X = sorted([int(i) for i in input().split()]) inf = 10**9 ans = inf for i in range(N - 1): if X[i] != X[i + 1]: ans = min(ans, X[i + 1] - X[i]) if ans < inf: print(ans) else: print(0)