N = int(input()) X = [int(x) for x in input().split()] print(X) X = list(set(X)) print(X) X.sort() N = len(X) if N == 1: print(0) exit() print(min([X[i+1]-X[i] for i in range(N-1)]))