input() N=sorted(set(map(int, input().split()))) A=[N[i+1]-N[i] for i in range(len(N)-1)] print(min(A) if len(A)>0 else 0)