import sys



read = sys.stdin.buffer.read

input = sys.stdin.buffer.readline

inputs = sys.stdin.buffer.readlines





# mod=10**9+7

# rstrip().decode('utf-8')

# map(int,input().split())

#import numpy as np





def main():

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

	

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

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

	else:

		ma=max(a,b)

		mi=min(a,b)

		ko1=min(n-mi,ma-1)

		

		ko2=n-ma+1+(n-(mi+(n-ma+1)))//2

		ko3=mi-1+1+((ma-(mi-1+1))-1)//2

		

		print((min(ko1,ko2,ko3)))

		

		

		

	

	

	

	

	

if __name__ == "__main__":

	main()

import sys

input = sys.stdin.buffer.readline



#sys.setrecursionlimit(10**9)

#from functools import lru_cache



def RD(): return input().rstrip().decode()

def II(): return int(eval(input()))

def FI(): return int(eval(input()))

def MI(): return list(map(int,input().split()))

def MF(): return list(map(float,input().split()))

def LI(): return list(map(int,input().split()))

def LF(): return list(map(float,input().split()))

def TI(): return tuple(map(int,input().split()))

# rstrip().decode()



import bisect



def main():

	n,a,b=MI()



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

		ans=abs(b-a)//2



	else:

		if b<a:

			a,b=b,a

		ans=min(a-1,n-b)+1+(b-a-1)//2



	print(ans)



































if __name__ == "__main__":

	main()

import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
    n, a, b = list(map(int, input().split()))
    if (b - a) % 2 == 0:
        print(((b - a) // 2))
    else:
        ma = max(a, b)
        mi = min(a, b)
        ko1 = min(n - mi, ma - 1)
        ko2 = n - ma + 1 + (n - (mi + (n - ma + 1))) // 2
        ko3 = mi - 1 + 1 + ((ma - (mi - 1 + 1)) - 1) // 2
        print((min(ko1, ko2, ko3)))


if __name__ == "__main__":
    main()

import sys

input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
    return input().rstrip().decode()


def II():
    return int(eval(input()))


def FI():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def MF():
    return list(map(float, input().split()))


def LI():
    return list(map(int, input().split()))


def LF():
    return list(map(float, input().split()))


def TI():
    return tuple(map(int, input().split()))


# rstrip().decode()
import bisect


def main():
    n, a, b = MI()
    if abs(b - a) % 2 == 0:
        ans = abs(b - a) // 2
    else:
        if b < a:
            a, b = b, a
        ans = min(a - 1, n - b) + 1 + (b - a - 1) // 2
    print(ans)


if __name__ == "__main__":
    main()

-read = sys.stdin.buffer.read -inputs = sys.stdin.buffer.readlines -# mod=10**9+7 -# rstrip().decode('utf-8') -# map(int,input().split()) -# import numpy as np +# sys.setrecursionlimit(10**9) +# from functools import lru_cache +def RD(): +    return input().rstrip().decode() + + +def II(): +    return int(eval(input())) + + +def FI(): +    return int(eval(input())) + + +def MI(): +    return list(map(int, input().split())) + + +def MF(): +    return list(map(float, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +def LF(): +    return list(map(float, input().split())) + + +def TI(): +    return tuple(map(int, input().split())) + + +# rstrip().decode() +import bisect + + -    n, a, b = list(map(int, input().split())) -    if (b - a) % 2 == 0: -        print(((b - a) // 2)) +    n, a, b = MI() +    if abs(b - a) % 2 == 0: +        ans = abs(b - a) // 2 -        ma = max(a, b) -        mi = min(a, b) -        ko1 = min(n - mi, ma - 1) -        ko2 = n - ma + 1 + (n - (mi + (n - ma + 1))) // 2 -        ko3 = mi - 1 + 1 + ((ma - (mi - 1 + 1)) - 1) // 2 -        print((min(ko1, ko2, ko3))) +        if b < a: +            a, b = b, a +        ans = min(a - 1, n - b) + 1 + (b - a - 1) // 2 +    print(ans)