import Data.List
import Data.Maybe

main = do
 abc <- map (read::String->Double) .words <$> getLine
 let ave = (sum abc) / 2 ::Double
 let super = zipWith map (map (f ave) [1..]) $ repeat abc ::[[Double]]
 --print $head super
 --print ave
 --print .target (ave * 2/3) $head super
 
 let index = fromJust.findIndex (target (ave * 2/3))  $ super ::Int
 --print $ super!!index
 if and.map (\t -> t == (sum abc)/3 ) $ super!!index 
 then print (-1)  else print $ index + 1 
 
  

f :: Double -> Int -> (Double->Double)
f ave 1 = (\x -> ave- x/2)
f ave n = (\x -> ave- x/2) . f ave (n-1)
 

target :: Double -> [Double] -> Bool
target ave x =( 
               (or.map (\t -> ((ceiling t) `mod` 2 == 1)) $ x) ||
               (and.map (\s -> s == ave) $ x) 
              )
              && (and.map (\r -> ceiling r == floor r) $ x)

 --