let input_int_array n =
  Array.init n (fun _ -> Scanf.scanf "%d " (fun v -> v))
  
let () =
  let ar = input_int_array 3
  in Array.sort Pervasives.compare ar;
  let a,b,c = match ar with
    | [|a;b;c|] -> a,b,c
    | _ -> failwith ""
  in
  let rec f0 a b c = match (a mod 2, b mod 2, c mod 2) with
    | 0,0,0 | 1,1,1 ->
      (c-a)/2 + (c-b)/2
    | 0,0,1 | 1,1,0 ->
      (b-a)/2 + c-b (*a,b,c=>b,b,c*)
    | 0,1,0 | 1,0,1 ->
      (c+1-b)/2 + f0 a c (c+1) (*a,b,c=>a,c,(c+1)*)
    | 0,1,1 | 1,0,0 ->
      (c+1-a)/2 + f0 b c (c+1) (*a,b,c=>b,c,(c+1)*)
    | _ -> failwith ""
  in
  f0 a b c |> string_of_int |> print_endline
