N = int(input()) X = list(set(map(int, input().split()))) X.sort() print(min([abs(X[i] - X[i - 1])for i in range(len(X))]))