countIf :: Int -> String -> Int
countIf count string
  | string == "" = count
  | otherwise = countIf (count + (countInt x)) xs
  where (x:xs) = string

countInt :: Char -> Int
countInt char
  | char == "2" !! 0 = 1
  | otherwise = 0

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

