io = STDIN
n=io.gets.to_i
aa=io.gets.split.map(&:to_i)
aaa=aa.clone
ans=0
aa.each_cons(2).with_index(0) do |x,i|
  a,b=x
  if a==i+1 && b==i+2
    aaa[i],aaa[i+1]=aaa[i+1],aaa[i]
    ans+=1
  end
end
aaa.each_with_index do |x,i|
  if x==i+1
    ans+=1
  end
end
puts ans
