n=int(input()) l=sorted(set(map(int,input().split()))) print(min(map(lambda x,y:abs(x-y),l[1:],l[:-1])))