import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextLong()
    val a = sc.nextLong()
    val b = sc.nextLong()
    if ((b - a) % 2L == 0L) {
        println((b - a) / 2L)
    } else {
        println(Math.min(a + (b - a) / 2L, n - b + 1 + (b - a) / 2L))
    }
}
