import Data.List

main :: IO ()
main = sameIntegersDo


sameIntegers abcs = loop (sort abcs) 0
    where
        loop [a,b,c] count
            | a == b && b == c = count
            | c - b > 1 = loop [a, b + 2, c] (count + 1)
            | b - a > 1 = loop [a + 2, b, c] (count + 1)
            | a < b && b < c = count + 3
            | otherwise      = count + 1

sameIntegersDo = do
    abcs <- map read . words <$> getLine
    print $ sameIntegers abcs