solve :: String -> Int
solve xs
    | length xs < 3 = 0
    | th == "ABC" = 1 + solve (tail xs) 
    | otherwise = solve (tail xs)
        where th = take 3 xs

main = do
    getLine
    xs <- getLine :: IO String
    print $ solve xs