n = int(input()) x = list(map(int,input().split())) x.sort() ans = 1000000 for i in range(n-1): y = (x[i+1])-(x[i]) if y == 0: continue elif y