N=int(input())
P=list(map(int,input().split()))
count=0
flag=0
for i in range(N):
    if flag:
        flag=0
        continue
    if P[i]==i+1:
        count+=1
        if P[i+1]==i+2:
            flag=1
print(count)
