main = do
  n <- readLn :: IO Int
  s <- getLine :: IO String
  putStrLn $ show $ abc $ zip s $ tail $ zip s $ tail s

abc t = foldl step 0 t
    where step a (x,(y,z)) = a + if z == 'C' && y == 'B' && x == 'A' then 1 else 0
