n = int(input()) *a, = sorted(set(map(int,input().split()))) print(min(i-j for i,j in zip(a[1:],a)) if len(a)>1 else 0)