let n = Scanf.scanf " %d" (+) 0
let ps = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let i, ans = ref 0, ref 0
let _ = while !i < n do if ps.(!i) = !i + 1 then (incr i; incr ans); incr i done; Printf.printf "%d\n" !ans