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)
for n in range(len(i)-1):
    if i[n+1]-i[n]==1:
        s-=1

print s

#c=0
#for t in i:
#    if p[t]!=t+1:
#        continue
#    if t==0:
#        p[t],p[t+1]=p[t+1],p[t]
#        c+=1
#    else:
#        if p[t]==t:
#            p[t],p[t+1]=p[t+1],p[t]
#            c+=1
#        else:
#            p[t-1],p[t]=p[t],p[t-1]
#            c+=1
#
#print c
