let () = Scanf.scanf "%d %d %d" @@ fun n a b ->
  Printf.printf "%d\n" @@
  if a mod 2 = b mod 2
  then abs (a - b) / 2
  else begin
    min
      ( let x = min a b in
        x + (max a b - x - 1) / 2 )
      ( let x = n - max a b + 1 in
        x + (n - min a b - x) / 2 )
  end
