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