main :: IO()
main = do
    let n = 0
    [_,str] <- lines <$>getContents
    print $countABC n str
    
countABC :: Int -> String -> Int
countABC x s
    |s=="" = x
    |take 3 s =="ABC" = countABC (x+1) $drop 3 s
    |otherwise = countABC x $drop 1 s