fun main(args : Array<String>) {
    val (n, a, b) = readLine()!!.split(" ").map { it.toLong() }

    if ((b-a) % 2L == 0L) {
        println((b-a) / 2L)
    } else {
        val diffA = a - 1L
        val diffB = n - b

        if (diffA <= diffB) {
            val posB = b - diffA - 1L
            println((posB - 1L) / 2L + diffA + 1L)
        } else {
            val posA = a + diffB + 1L
            println((n-posA) / 2L + diffB + 1L)
        }
    }
}