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



if A % 2 == B % 2:

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

else:

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



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

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

else:

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

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

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