input() X = list(set(map(int, input().split()))) n = len(X) if n == 1: print(0) exit() X.sort() ans = 10**18 for i in range(n - 1): ans = min(ans, X[i + 1] - X[i]) print(ans)