n=int(input()) ls=list(map(int,input().split())) ls.sort() lsdis=[] for i in range(n-1): lsdis.append(ls[i+1]-ls[i]) lsnew=[] for i in range(len(lsdis)): if lsdis[i]!=0: lsnew.append(lsdis[i]) if len(lsnew)==0: print(0) else: print(min(lsnew))