import Control.Applicative ((<$>)) main :: IO () main = do solve <$> getLine >>= print solve :: String -> Int solve s = 1 + 2 * (length s) + (sum . map f) s where f c | c `elem` "0469" = 1 | c == '8' = 2 | otherwise = 0