main = do
    getLine
    s <- getLine
    print $ countABC s

countABC :: String -> Integer
countABC (x:y:[]) = 0
countABC (x:y:z:xs)
    | x == 'A' && y == 'B' && z == 'C'  = 1 + countABC (y:z:xs)
    | otherwise                         = countABC (y:z:xs)
