{-# LANGUAGE OverloadedStrings #-} import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B main :: IO () main = B.getLine >> solve <$> B.getLine >>= print solve :: ByteString -> Int solve = f 0 where f ct s | B.null s = ct | "CPCTF" `B.isPrefixOf` s = f (ct + 1) (B.drop 5 s) | "CPCTCPC" `B.isPrefixOf` s = f (ct + 1) (B.drop 7 s) | otherwise = f ct (B.tail s)