import Control.Applicative
import Debug.Trace

f a b c = do
  let xs = [a, b, c]
  let p = if all odd xs || all even xs then 0 else 1
  let xs' = case length $ filter id $ map odd xs of
        0 -> xs
        1 -> map (\i -> if even i then succ i else i) xs
        2 -> map (\i -> if odd i then succ i else i) xs
        _ -> xs
  let xs = map (`div` 2) xs'
  let m = maximum xs
  p + (sum $ map (m - ) xs)

main = do
  [a, b, c] <- map read <$> words <$> getLine :: IO [Int]
  --let [a, b, c] = [2,6,3]
  print $ f a b c
