n=int(input());c=10**6 x=[i for i in {*[*map(int,input().split())]}] for i in range(len(x)): c=min(c,abs(x[i]-x[i-1])) print(c)