let N = stdin.ReadLine() |> int
let A = stdin.ReadLine().Split() |> Array.map int |> Array.toList

let rec loop i items count =
    match items with
    | [] -> count
    | head :: tail -> if i = head then loop (i+1) (head::tail.Tail) (count+1) 
                      else loop (i+1) tail count

loop 1 A 0 |> stdout.WriteLine