n=int(input()) a=list(map(int,input().split())) M=a[-1]-a[0] m=10**10 for i in range(n-1): if a[i+1]-a[i]