#!/usr/bin/env stack
-- stack --resolver lts-11.2 script

import Control.Monad ( when )
import Debug.Trace

main :: IO ()
main = do
  ns <- (map read. words) <$> getLine :: IO [Int]

  let ks = filter (\n -> n `mod` 2 /= 0) ns
      gs = filter (\n -> n `mod` 2 == 0) ns

  case length ks of
    0 -> do
      let max   = maximum gs
          toMax = map (\n -> (max-n) `div` 2) gs
      print (sum toMax)
    1 -> do
      let gs'   = map (+1) gs
          max   = maximum $ ks ++ gs'
          toMax = map (\n -> (max-n) `div` 2) $ ks ++ gs'
      print (sum toMax + 1)
    2 -> do
      let ks'   = map (+1) ks
          max   = maximum $ ks' ++ gs
          toMax = map (\n -> (max-n) `div` 2) $ ks' ++ gs
      print (sum toMax + 1)
    3 -> do
      let max   = maximum ks
          toMax = map (\n -> (max-n) `div` 2) ks
      print (sum toMax)
