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