import Data.List (sort)

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


solve :: Int -> Int -> Int -> Int
solve a b c =
  (c-a)`div`2 + (c-b)`div`2 + extra
  where
    extra
      | odd (c-a) && odd (c-b) = 1
      | odd (c-a)              = 2
      | odd (c-b)              = 2
      | otherwise              = 0