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

    var ans = 0L

    if ((B - A) % 2L == 0L) {
        ans = (B - A) / 2L
    } else {
        if (A - 1L < N - B) {
            ans = A
            B -= A
            A = 1
            ans += (B - A) / 2L
        } else {
            ans = N - B + 1L
            A += N - B + 1L
            B = N
            ans += (B - A) / 2L
        }
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}
