import Control.Applicative
import Data.List

solve :: [Int] -> Int
solve xs | not $ all (\x -> mod x 2 == 0) xs = 0
         | group xs == [xs] = -10000000
         | l == 0 = 1 + (solve $ next xs)
         | l == 1 = 1
         | l == 2 = 1
         | l == 3 = 1 + (solve $ next xs)
            where l = length $ filter (\x -> mod x 4 == 0) xs

next :: [Int] -> [Int]
next [a,b,c] = [y+z,x+z,x+y]
                where [x,y,z] = map (\x -> div x 2) [a,b,c]

main = do
    xs <- map read .words <$> getLine
    let ans = if solve xs < 0 then "-1" else show $ solve xs
    putStrLn ans
