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