import Control.Applicative
import Data.List

main = do
 list <- map read . words <$> getLine
 print $ solve list

solve :: [Int] -> Int
solve list = f (a,b,c)
    where [a,b,c] = sort list

f :: (Int,Int,Int) -> Int
f (a,b,c) = g (c-a) (c-b) 

g :: Int -> Int -> Int
g a b = ra + rb + (h' ma mb)
    where (ra,ma) = h a 2
          (rb,mb) = h b 2

h' 0 0 = 0
h' 0 1 = 2
h' 1 0 = 2
h' 1 1 = 1

h x y = (div x y, mod x y)
