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