N=int(input())
Data=list(map(int,input().split()))
count=0
cnt=0
Flag=[]
for i in range(N):
    if i+1==Data[i]:
        count+=1
        Flag.append(1)
    else:Flag.append(0)
for i in range(count):
    for j in range(N-1):
        if Flag[j]==Flag[j+1]==1 or Flag[j]*Flag[j+1]==0 and Flag[j]+Flag[j+1]==1:
            Data[j],Data[j+1]=Data[j+1],Data[j]
            Flag[j+1],Flag[j]=0,0
            cnt+=1
            break
print(cnt)
