import Data.List (splitAt) 
main = do
  n <- getLine 
  s <- getLine
  print $ countABC' 0 s

countABC' :: Int -> String -> Int
countABC' n xs@(x:xs') | length xs < 3 = n
                       | otherwise = let (l,r) = splitAt 3 xs
                                     in if l == "ABC" then countABC' (n+1) r
                                                      else countABC' n xs' 