n = int(input()) x = list(map(int,input().split())) x.sort() mi = 10 ** 6 for i in range(len(x) - 1): s = x[i + 1] - x[i] if mi > s and s > 0: mi = s print(mi)