import Control.Applicative
import Data.List

main :: IO ()
main = do
    s <- getLine
    putStrLn $ show (solve (sort s))

solve :: String -> Int 
solve s | "000" == s = 0
        | "001" == s = 1
        | "011" == s = 2
        | "111" == s = 3