N = int(input())
p = list(map(int,input().split()))
ppp = [0]*N
for i in range(N):
    if i == p[i] - 1:
        ppp[i] = 1
cnt = 0
while True:
    if 1 not in ppp:
        print(cnt)
        exit()
    a = ppp.index(1)
    if a == len(ppp) - 1:
        ppp[a] = 0
    elif ppp[a+1] == 1:
        ppp[a],ppp[a+1] = 0,0
    else:
        ppp[a] = 0
    cnt += 1