scan :: Int -> Int
scan = iter 0 where
    iter c n = case divMod n 10 of
        (0, r) -> if r == 2 then c+1 else c
        (q, r) -> if r == 2 then iter (c+1) q else iter c q

main :: IO() 
main = do
    n  <- readLn :: IO Int
    let ans = scan n
    print ans