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