n = int(input()) xn = list(sorted(set(map(int,input().split())))) if len(xn)==1: print(0) else: print(min([abs(xn[i]-xn[i+1]) for i in range(len(xn)-1)]))