n=int(input()) x=sorted(map(int,input().split())) ans=10**6 if n==1: ans=0 for i in range(n-1): ans=min(ans,abs(x[i]-x[i+1])) print(ans)