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

if (max(A,B)-min(A,B))%2==0:

    cnt = (max(A,B)-min(A,B))//2

else:

    cnt1 = min(max(A,B)-1,N-min(A,B))

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

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

    cnt = min(cnt1,cnt2,cnt3)

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

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

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

else:

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

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

    else:

        print((N-B+1+(B-A-1)//2))
N, A, B = list(map(int, input().split()))
if (max(A, B) - min(A, B)) % 2 == 0:
    cnt = (max(A, B) - min(A, B)) // 2
else:
    cnt1 = min(max(A, B) - 1, N - min(A, B))
    cnt2 = min(A, B) + (max(A, B) - min(A, B) - 1) // 2
    cnt3 = N - max(A, B) + 1 + (max(A, B) - min(A, B) - 1) // 2
    cnt = min(cnt1, cnt2, cnt3)
print(cnt)

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

-if (max(A, B) - min(A, B)) % 2 == 0: -    cnt = (max(A, B) - min(A, B)) // 2 +if (B - A) % 2 == 0: +    print(((B - A) // 2)) -    cnt1 = min(max(A, B) - 1, N - min(A, B)) -    cnt2 = min(A, B) + (max(A, B) - min(A, B) - 1) // 2 -    cnt3 = N - max(A, B) + 1 + (max(A, B) - min(A, B) - 1) // 2 -    cnt = min(cnt1, cnt2, cnt3) -print(cnt) +    if (A - 1) <= (N - B): +        print((A + (B - A - 1) // 2)) +    else: +        print((N - B + 1 + (B - A - 1) // 2))