N = int(input()) X = list(set(map(int,input().split()))) A = 10**9 for a,b in zip(X[:-1],X[1:]): A = min(A,b-a) print(A)