N = int(input()) L = sorted(list(set(map(int, input().split())))) if len(L) == 1: d = 0 else: d = abs(L[1] - L[0]) for n in range(len(L)): if abs(L[n] - L[n-1]) < d: d = abs(L[n] - L[n-1]) print(d)