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