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