n = int(input()) R = [0]+list(map(int,input().split()))+[n] ans = 0 now = 1 while now < n: m = 0 nex = R[now] for i in range(now,nex+1): m = max(m,R[i]) ans += 1 now = nex print(ans)