let n = stdin.ReadLine() |> int
let str = stdin.ReadLine().ToCharArray();

let getABC s = 
    let rec inner s count =
      if (s |> Array.length) <= 2 then count
      else
        let str = s.[0..2] |> System.String 
        inner (s |> Array.tail) (if str = "ABC" then count+1 else count)
    inner s 0

str |> getABC |> stdout.WriteLine