n, a, b = list(map(int, input().split()))

d = b - a

if d % 2 == 0:

    print((d//2))

else:

    dd = d//2

    ans = min(dd + a, n - b + 1 + dd)

    print(ans)
n, a, b = list(map(int, input().split()))

dist = abs(a-b)-1

if dist % 2 != 0:

    ans = dist//2+1

else:

    dist -= 1

    ans = min(a+dist//2+1, n-b+1+dist//2+1)



print(ans)

n, a, b = list(map(int, input().split()))
d = b - a
if d % 2 == 0:
    print((d // 2))
else:
    dd = d // 2
    ans = min(dd + a, n - b + 1 + dd)
    print(ans)

n, a, b = list(map(int, input().split()))
dist = abs(a - b) - 1
if dist % 2 != 0:
    ans = dist // 2 + 1
else:
    dist -= 1
    ans = min(a + dist // 2 + 1, n - b + 1 + dist // 2 + 1)
print(ans)

-d = b - a -if d % 2 == 0: -    print((d // 2)) +dist = abs(a - b) - 1 +if dist % 2 != 0: +    ans = dist // 2 + 1 -    dd = d // 2 -    ans = min(dd + a, n - b + 1 + dd) -    print(ans) +    dist -= 1 +    ans = min(a + dist // 2 + 1, n - b + 1 + dist // 2 + 1) +print(ans)