N = int(input())
R = list(map(int,input().split()))

M = [0] * N
M[0] = R[0]
for i in range(1,N-1):
    M[i] = max(M[i-1],R[i])
count = 0
now = 1
while now < N:
    count += 1
    now = M[now-1]
print(count)