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 up_max = max (n - a) (n - b)
           let down_max = max (a - 1L) (b - 1L)
           min up_max down_max

ans
|>stdout.WriteLine