import Data.List

solve n c
    | (n `rem` 2) == (tar `rem` 2) = (tar - n) `div` 2
    | otherwise = solve n (c + 1)
    where
        tar = c * 3

main = do
    [a,b,c] <- sort . map read . words <$> getLine
    print $ solve (a+b+c) c 