let [|n;a;b|] = stdin.ReadLine().Split() |> Array.map int64

let flag = (if ((a % 2L) = (b % 2L)) then 1L else 0L)

let ans = if flag = 1L then ((b - a)/2L) else
           let a_min = min (a - 1L) (n - a)
           let b_min = min (b - 1L) (n - b)
           max a_min b_min

ans
|>stdout.WriteLine