module Main where
import qualified Control.Monad as C
import qualified Data.Char as C
import qualified Data.List as L
import qualified Data.Map as M
import qualified Data.Array as A

int = read :: String -> Int
getWord :: IO String
getWord = do
  c <- getChar
  if C.isSpace c
  then
    return []
  else do
    ws <- getWord
    return (c:ws)
getInt = fmap int getWord
replace pred a = map (\x -> if pred x then a else x)

main = interact $ printer . solver . parser
parser = map int . words
printer = unlines . (:[]) . show

solver [a,b,c] = answer
  where
    answer = minimum $ map func [0..52]
    func x = sum $ map (func2 x) [a,b,c]
func2 x n  
  | x < n      = n - x 
  | odd(x - n) = 1 + (x-n+1)`div`2
  | otherwise  = (x-n)`div`2
  
