let count_ABC str sz =
  let rec iter_count pos rest =
    if pos >= sz - 2
    then rest
    else 
      if String.sub str pos 3 = "ABC"
      then iter_count (pos+1) (rest+1)
      else iter_count (pos+1) rest
  in iter_count 0 0

let () = Scanf.scanf "%d\n %s" @@ fun n s -> Printf.printf "%d\n" @@ count_ABC s n