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