N=int(input()) X=sorted(map(int,set(input().split()))) try:print(min([X[i+1]-X[i] for i in range(len(X)-1)])) except:print(0)