import Control.Applicative
import Data.Char

main = do w <- map toLower <$> getLine
          s <- init . map (map toLower) . concatMap words . lines <$> getContents
          print . length $ filter (== w) s