N=int(input()) X=list(map(int,input().split())) X=sorted(set(X)) if len(X)==1: print(0) else: print(min([abs(X[i]-X[i-1]) for i in range(len(X))]))