import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val n = sc.nextLong
  val a = sc.nextLong
  val b = sc.nextLong

  val res =
    if((b - a ) % 2 == 0) (b - a) / 2
    else Math.min(
      Math.max(a - 1, b - 1),
      Math.max(n - a, n - b)
    )

  println(res)
}