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