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 f a b = (b - a) / 2L

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

solve A B |> printfn "%d"