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