let input() = stdin.ReadLine()
let inputs() = input().Split()

let YN b = printfn "%s" (if b then "Yes" else "No")
let print x = printfn "%A" x
let printS (s: string) = printfn "%s" s


let N = int (input())
let S = input()

open System.Linq


S.Replace("ABC", "0").Count(fun c -> c = '0') |> print
