{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = do
  n <- readLn
  s <- B.getLine
  print $ solve n s

solve :: Int -> B.ByteString -> Int
solve _ s = length $ B.findSubstrings "ABC" s
