countIfTwo :: Int -> Char -> Int
countIfTwo accumlator char
  | char == head "2" = accumlator + 1
  | otherwise        = accumlator

main = do
  string <- getLine
  let result = foldl countIfTwo 0 string
  putStrLn $ show result