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

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

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

else:

  x1 = N-max(A,B)

  ans1 = N- max(A,B) + 1 + (-min(A,B)+max(A,B)-1)//2



  ans2 = min(A,B)+(max(A,B)-min(A,B)-1)//2

  print((min(ans1,ans2)))
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 abs(B - A) % 2 == 0:
    print((abs(B - A) // 2))
else:
    x1 = N - max(A, B)
    ans1 = N - max(A, B) + 1 + (-min(A, B) + max(A, B) - 1) // 2
    ans2 = min(A, B) + (max(A, B) - min(A, B) - 1) // 2
    print((min(ans1, ans2)))

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)))

-if abs(B - A) % 2 == 0: -    print((abs(B - A) // 2)) +if (B - A) % 2 == 0: +    print(((B - A) // 2)) -    x1 = N - max(A, B) -    ans1 = N - max(A, B) + 1 + (-min(A, B) + max(A, B) - 1) // 2 -    ans2 = min(A, B) + (max(A, B) - min(A, B) - 1) // 2 -    print((min(ans1, ans2))) +    print((min(A + (B - A - 1) // 2, N - B + 1 + (B - A - 1) // 2)))