N=int(input()) X=list(map(int,input().split())) m=X[0] if len(X)==1 else abs(X[0]-X[1]) for e in range(1,N-1): m=min(m,abs(X[e]-X[e+1])) print(m)