N=int(input())
num=0
Data=list(map(int,input().split()))
for i in range(N-1):
    if i+1==Data[i] and i<N:
        Data[i],Data[i+1]=Data[i+1],Data[i]
        num+=1
    elif i+1==N:
        if i+1==Data[i]:
            num+=1
print(num)