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