open System

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

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

let isEven x = (x % 2) = 0

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

solve A B |> printfn "%d"