n=int(input()) x=list(map(int,input().split())) x.sort() a=[abs(x[i]-x[i+1]) for i in range(n) if i+1= 1] print(min(a) if a else 0)