fun main(args: Array<String>) {

    val (n, a, b) = readLine()!!.split(" ").map(String::toLong)
    val result = if (a % 2 == 1L && b % 2 == 1L || a % 2 == 0L && b % 2 == 0L) {
        Math.abs(a - b) / 2
    } else {
        val big = if (a > b) a else b
        val small = if (a < b) a else b
        if (small - 1 + big - 1 < n - small + n - big) {
            val dis = small - 1
            Math.abs((small - dis - (big - dis - 1)) / 2) + (dis + 1)
        } else {
            val dis = n - big
            Math.abs(((small + dis + 1) - (b + dis)) / 2) + (dis + 1)
        }
    }
    println(result)
}


