N = int(input()) lsR = list(map(lambda x:int(x)-1,input().split())) now = 0 nextto = lsR[now] cnt = 0 while True: if now == N-1: break for j in range(now,nextto): nextto = max(nextto,lsR[j]) now = lsR[now] cnt += 1 print(cnt)