n = int(input()) li = list(set(map(int, input().split()))) li.sort dif = [] if not len(li) == 0: for i in range(len(li) - 1): if li[i + 1] - li[i] >= 0: dif.append(li[i + 1] - li[i]) print(min(dif))