n = int(input()) a = sorted(list(map(int,input().split()))) res = 0 for i, j in zip(a, a[1:]): if i == j: continue else: if res == 0: res = abs(i - j) else: res = min(res, abs(i - j)) print(res)