N=int(raw_input())
p=map(int,raw_input().split(' '))

i=[]
for j in range(1,N+1):
    if p[j-1]==j:
        i.append(j-1)

#print i
s=len(i)

flg=0
for n in range(len(i)-1):
    if flg==1:
        flg=0
        continue
    if i[n+1]-i[n]==1:
        s-=1
        flg=1

print s

