open System
let R T = stdin.ReadLine()|> T
let RS T = stdin.ReadLine().Split()|>Array.map T
let Mod = (1e9|>int64)+7L
[<EntryPoint>]
let main argv =
    let N = R int
    let S = R string
    [0..N-3]
    |>Seq.sumBy(fun c -> if S.[c..(c+2)]="ABC" then 1 else 0)
    |>stdout.WriteLine
    0
