n=io.read("*n","*l")
p={}
for i=1,n do
    p[i]=io.read("*n")
end

counter=0
for i=1,n-1 do
    if p[i]==i then
        p[i],p[i+1]=p[i+1],p[i]
        counter=counter+1
    end
end
if p[n]==n then
    counter=counter+1
end
print(counter)