import qualified Data.Text as T
import qualified Data.Text.IO as T

main :: IO ()
main = do
    _ <- T.getLine
    s <- T.getLine
    putStrLn $ show (solve s)

solve :: T.Text -> Int
solve s = T.count (T.pack "ABC") s