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

if (b-a)%2==0:

    print(((b-a)//2))

else:

    print((min(n-b+1+(b-a-1)//2,a+(b-a)//2)))
n,a,b=map(int,input().split())

x=b-a

p=print

if (b-a)%2==0:p((b-a)//2)

else:p(min(n-b+1+(x-1)//2,a+x//2))

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

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

-n, a, b = list(map(int, input().split())) +n, a, b = map(int, input().split()) +x = b - a +p = print -    print(((b - a) // 2)) +    p((b - a) // 2) -    print((min(n - b + 1 + (b - a - 1) // 2, a + (b - a) // 2))) +    p(min(n - b + 1 + (x - 1) // 2, a + x // 2))