N, A, B = list(map(int, input().split()))

if ((B-A)%2 == 0):

  print(((B-A)//2))

else: 

  print((min([A+(B-A-1)//2 ,N-B+ 1 +(B-A-1)//2])))
N, A, B = list(map(int,input().split()))

if ((A-B)%2==0):

  ans = abs(A-B)//2

elif (N-B <= A-1):

  ans = (2*N -A-B+1)//2

elif (N-B > A-1):

  ans = (B+A-1)//2

print(ans)
N, A, B = list(map(int, input().split()))
if (B - A) % 2 == 0:
    print(((B - A) // 2))
else:
    print((min([A + (B - A - 1) // 2, N - B + 1 + (B - A - 1) // 2])))

N, A, B = list(map(int, input().split()))
if (A - B) % 2 == 0:
    ans = abs(A - B) // 2
elif N - B <= A - 1:
    ans = (2 * N - A - B + 1) // 2
elif N - B > A - 1:
    ans = (B + A - 1) // 2
print(ans)

-if (B - A) % 2 == 0: -    print(((B - A) // 2)) -else: -    print((min([A + (B - A - 1) // 2, N - B + 1 + (B - A - 1) // 2]))) +if (A - B) % 2 == 0: +    ans = abs(A - B) // 2 +elif N - B <= A - 1: +    ans = (2 * N - A - B + 1) // 2 +elif N - B > A - 1: +    ans = (B + A - 1) // 2 +print(ans)