# 2019/09/06

n=int(input())
p=[0]+list(map(int,input().split()))+[n+1]

cnt=0
for i in range(1,n+1):
    if i!=p[i]:continue
    if i==p[i-1] or i==1:
        p[i],p[i+1]=p[i+1],p[i]
    else:
        p[i],p[i-1]=p[i-1],p[i]
    cnt+=1
    
print(cnt)