N = int(input()) X = list(map(int,input().split())) X = list(set(X)) candidate = [] for i in range(len(X)-1) : a = X[i+1] - X[i] candidate.append(a) print(min(candidate))