local n, a, b = io.read("*n", "*n", "*n")
if (a + b) % 2 == 0 then
  print((b - a) // 2)
else
  local c = b - a
  local p1 = a + (c - 1) // 2

  a, b = n + 1 - a, n + 1 - b
  local d = b - a
  local p2 = a + (d - 1) // 2
  print(math.min(p1, p2))
end
