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