
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val n, a, b = sc.nextInt()
  if ((b - a) % 2 == 0) {
    println((b - a) / 2)
  } else {
    if (n - b < a - 1) {
      println(n - a)
    } else {
      println(b - 1)
    }
  }
}