from itertools import combinations i=input i() X=list(map(int,i().split())) print(min([max(i-j,j-i, 1) for i,j in combinations(X,2)]))