n = gets.chomp.to_i
pi = gets.chomp.split(' ').map(&:to_i)
pa = Array.new(pi.size, false)
ans = 0

pi.each_with_index do |a, i|
  pa[i] = true if a != i + 1
end

for i in 0..(pa.size) do
  if pa[i] == false
    t = pi[i]
    pi[i] = pi[i+1]
    pi[i+1] = t
    pa[i] = true
    if pi[i+1] == i+1
      pa[i+1] = false
    else
      pa[i+1] = true
    end
    ans += 1
  end
end

puts ans
