n = gets.to_i
ps = gets.split.map(&:to_i)

ans = 0
(0..n-1).each do |i|
  p = ps[i]
  if p == i+1
    t = ps[i+1]
    ps[i+1] = p
    ps[i] = t
    ans += 1
  ends
end

if ps[n-1] == n
  ans += 1
end
puts ans

