from statistics import median

#import collections

#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]

from fractions import gcd

from itertools import combinations # (string,3) 3回

from collections import deque

from collections import defaultdict

import bisect

#

#    d = m - k[i] - k[j]

#    if kk[bisect.bisect_right(kk,d) - 1] == d:

#

#

#

# pythonで無理なときは、pypyでやると正解するかも！！

#

#



import sys

sys.setrecursionlimit(10000000)

mod = 10**9 + 7



def readInts():

  return list(map(int,input().split()))

def main():

    n,a,b = readInts()

    ab = abs(a-b)

    if ab % 2 == 0:

        print((ab//2))

    else:

        print((min(a + (ab-1)//2, n - b + 1 + (ab-1)//2)))



if __name__ == '__main__':

  main()

#from statistics import median

#import collections

#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]

#from fractions import gcd

#from itertools import combinations # (string,3) 3回

#from collections import deque

#from collections import defaultdict

#import bisect

#

#    d = m - k[i] - k[j]

#    if kk[bisect.bisect_right(kk,d) - 1] == d:

#

#

#

# pythonで無理なときは、pypyでやると正解するかも！！

#

#



import sys

sys.setrecursionlimit(10000000)

mod = 10**9 + 7

#mod = 9982443453

def readInts():

  return list(map(int,input().split()))

def I():

  return int(eval(input()))

n,a,b = readInts()

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

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

else:

    print((min(a + (abs(b-a)-1)//2, n-b+1+(abs(b-a)-1)//2)))

from statistics import median

# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations  # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect

#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
import sys

sys.setrecursionlimit(10000000)
mod = 10**9 + 7


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


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


if __name__ == "__main__":
    main()

# from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from fractions import gcd
# from itertools import combinations # (string,3) 3回
# from collections import deque
# from collections import defaultdict
# import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
import sys

sys.setrecursionlimit(10000000)
mod = 10**9 + 7
# mod = 9982443453
def readInts():
    return list(map(int, input().split()))


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


n, a, b = readInts()
if abs(b - a) % 2 == 0:
    print((abs(b - a) // 2))
else:
    print((min(a + (abs(b - a) - 1) // 2, n - b + 1 + (abs(b - a) - 1) // 2)))

-from statistics import median - +# from statistics import median -from fractions import gcd -from itertools import combinations  # (string,3) 3回 -from collections import deque -from collections import defaultdict -import bisect - +# from fractions import gcd +# from itertools import combinations # (string,3) 3回 +# from collections import deque +# from collections import defaultdict +# import bisect - - +# mod = 9982443453 -def main(): -    n, a, b = readInts() -    ab = abs(a - b) -    if ab % 2 == 0: -        print((ab // 2)) -    else: -        print((min(a + (ab - 1) // 2, n - b + 1 + (ab - 1) // 2))) +def I(): +    return int(eval(input())) -if __name__ == "__main__": -    main() +n, a, b = readInts() +if abs(b - a) % 2 == 0: +    print((abs(b - a) // 2)) +else: +    print((min(a + (abs(b - a) - 1) // 2, n - b + 1 + (abs(b - a) - 1) // 2)))