N=int(input())
a=list(map(int,input().split()))
c=0
d=[]
for i in range(N):
        if(i+1==a[i]):
            d.append("x")
        else:
            d.append("o")
for i in range(len(d)):
    if d[i]=="x":
        d[i]="o"
        d[i+1]="o"
        c+=1
print(c)