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