import Data.List


main = do
    [a, b, c] <- map read . words <$> getLine
    putStrLn $ show $ ans a b c
    
ans :: Int -> Int -> Int -> Int
ans a b c = ret tmpsum
    where
        maxv = foldl1 max [a, b, c]
        acnt = (maxv - a) `div` 2
        bcnt = (maxv - b) `div` 2
        ccnt = (maxv - c) `div` 2
        newa = a + acnt * 2
        newb = b + bcnt * 2
        newc = c + ccnt * 2
        tmpsum = sum [newa, newb, newc]
        ret tmpsum
            | tmpsum == maxv * 3 = acnt + bcnt + ccnt
            | tmpsum == maxv * 3 - 1 = acnt + bcnt + ccnt + 2
            | otherwise = acnt + bcnt + ccnt + 1
