let inline scan () = System.Console.ReadLine()
let inline split (s: string) = s.Split(' ')

let xs = scan () |> split |> Array.map int

let (m, app) =
  match xs |> Array.map (fun x -> x % 2) |> Array.sum with
    | 0 -> (1, 0)
    | 1 -> (0, 1)
    | 2 -> (1, 1)
    | 3 -> (0, 0)

let xs' = [
    for x in xs do
      if x % 2 = m then
        yield x + 1
      else
        yield x
  ]

let max = List.max xs'
printfn "%i" <|
  (xs' |> Seq.map (fun x -> (max - x) / 2) |> Seq.sum) + app 
