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( (a + b - 1) / 2, (2 * n - a - b + 1) / 2 )

  println(res)
}