io = STDIN
n=io.gets.to_i
a=io.gets.split.map(&:to_i)
aa=a.map.with_index(1){|a,i|a==i ? "o":"x"}
ans=0
(n-1).times do |i|
  if aa[i]=="x"
    aa[i],aa[i+1]="o","o"
    ans+=1
  end
end
ans+=1 if aa[-1]=="x"
puts ans