a=int(input()) b=[int(i) for i in input().split()] c=set(b) d=[] for i in c: d.append(i) d.sort() e=[] for i in range(1,len(d)): e.append(d[i]-d[i-1]) if e==[]: print(0) else: print(min(e))