open System

let inputs = stdin.ReadLine().Split(' ')
//

//------------------------------------------------
let N = inputs.[0] |> int64
let A = inputs.[1] |> int64
let B = inputs.[2] |> int64

let isEven x = (x % 2L) = 0L

let solve a b =
    if isEven (a + b) then
        (a + b) / 2L - a
    else // Odd
        let b2 = b - a
        let m1 = (1L + b2) / 2L - 1L + a
        //
        let x  = N - b + 1L
        let a2 = a + x
        let m2 = (a2 + b) / 2L - 1L + a2
        //
        min m1 m2

solve A B |> printfn "%d"