n=int(input()) list=[int(i) for i in input().split()] c=10000000 d=0 for i in range(n-1): if list[i]-list[i+1]<0: d=(-1)*(list[i]-list[i+1]) elif list[i]-list[i+1]>0: d=list[i]-list[i+1] if c>d: c=d i=i+1 print(c)