(* O(1) *)
let a, b, c = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let ps = Array.make_matrix 2 3 0
let pn = Array.make 2 0
let f x =
  let r = x mod 2 in
  ps.(r).(pn.(r)) <- x;
  pn.(r) <- pn.(r) + 1
let _ =
  List.iter f [a; b; c];
  Printf.printf "%d\n" @@
    if pn.(0) = 3 || pn.(1) = 3 then
      let m = List.fold_left max 0 [a; b; c] in
      (3 * m - (a + b + c)) / 2
    else
      let i = List.find (fun i -> pn.(i) = 2) [0; 1] in
      let j = 1 - i in
      let x, y, z = ps.(i).(0), ps.(i).(1), ps.(j).(0) in
      let m = max x y + 1 in
      abs (x - y) / 2 + 1 + if m > z then (m - z) / 2 else m - z