a=int(input()) b=[int(i) for i in input().split()] b.sort() d=[] for i in range(1,a): d.append(b[i]-b[i-1]) print(min(d))