from heapq import * N=int(input()) R=list(map(int,input().split())) dist = [N]*N dist[0] = 0 que = [(0,0)] for i in range(N): d,rr = que[0] while i>rr: heappop(que) d,rr = que[0] dist[i] = d if i+1