fun main(args: Array<String>) {
    val (N, A, B) = readLine()!!.split(" ").map { it.toLong() }

    data class Point(var a: Long, var b: Long) {
        private var move = 0L
        fun isEvenDiff(): Boolean = (a - b) % 2 == 0L
        fun halfRange(): Long = move + Math.abs(a - b) / 2
        fun move() {
            if (a < b) {
                move = a
                a = 1
                b -= move
            } else {
                move = b
                b = 1
                a -= move
            }
        }
    }


    val list = arrayOf(Point(A, B), Point(1 + N - A, 1 + N - B))
    var ans = N

    list.forEach { p ->
        //        println(p)
        if (p.isEvenDiff()) {
            ans = Math.min(ans, p.halfRange())
        } else {
            p.move()
            //           println(p)
            ans = Math.min(ans, p.halfRange())
        }
    }
    println(ans)
}
