N = int(input()) X = list(map(int,input().split())) X.sort() ans=10**8 for i in range(N-1): if abs(X[i+1]-X[i])!=0: ans=min(ans,abs(X[i+1]-X[i])) if ans==10**8: print(0) else: print(ans)