a=input()
b=map(int,raw_input().split())
ans=0
while True:
    c=0
    for i in range(a):
        if b[i]==i+1:
            if b[i]!=i and i!=a-1:
                x=b[i]
                y=b[i + 1]
                b[i]=y
                b[i+1]=x
                ans+=1
            elif i!=0:
                x = b[i]
                y = b[i-1]
                b[i] = y
                b[i-1] = x
                ans += 1
            c=1
    if c==0:
        break

print ans