input();l=sorted(map(int,set(input().split())));print(min([l[i+1]-l[i]for i in range(len(X)-1)],default=0))