#yuki1868 INF=float('inf') n=int(input()) r=list(map(int,input().split())) x=0 res=[INF]*n res[0]=0 for i in range(n-1): while x