input();a=sorted(set(map(int,input().split())))[::-1] ans=float('inf') if len(a)>1: for i in range(1,len(a)): ans=min(ans,a[i-1]-a[i]) print(ans) else: print(0)