import sys, re, os

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10

from itertools import permutations, combinations, product, accumulate

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from fractions import gcd

def debug(*args):

    if debugmode:

        print((*args))

def input(): return sys.stdin.readline().strip()

def STR(): return eval(input())

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

def FLOAT(): return float(eval(input()))

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

def S_MAP(): return list(map(str, input().split()))

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

def S_LIST(): return list(map(str, input().split()))

def lcm(a, b): return a * b // gcd(a, b)

sys.setrecursionlimit(10 ** 9)

inf = sys.maxsize

mod = 10 ** 9 + 7

dx = [0, 0, 1, -1, 1, -1, -1, 1]

dy = [1, -1, 0, 0, 1, -1, 1, -1]

debugmode = True



n, a, b = MAP()

print((abs(a - b) // 2 if not (a - b) % 2 else abs(a - b) // 2 + min(min(a, b) - 1, n - max(a, b)) + 1))
import sys

def input(): return sys.stdin.readline().strip()

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



n, a, b = MAP()

print((abs(a - b) // 2 if not (a - b) % 2 else abs(a - b) // 2 + min(min(a, b) - 1, n - max(a, b)) + 1))
import sys, re, os
from collections import deque, defaultdict, Counter
from math import (
    ceil,
    sqrt,
    hypot,
    factorial,
    pi,
    sin,
    cos,
    radians,
    acos,
    atan,
    asin,
    log,
    log10,
)
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


def debug(*args):
    if debugmode:
        print((*args))


def input():
    return sys.stdin.readline().strip()


def STR():
    return eval(input())


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


def FLOAT():
    return float(eval(input()))


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


def S_MAP():
    return list(map(str, input().split()))


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


def S_LIST():
    return list(map(str, input().split()))


def lcm(a, b):
    return a * b // gcd(a, b)


sys.setrecursionlimit(10**9)
inf = sys.maxsize
mod = 10**9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True
n, a, b = MAP()
print(
    (
        abs(a - b) // 2
        if not (a - b) % 2
        else abs(a - b) // 2 + min(min(a, b) - 1, n - max(a, b)) + 1
    )
)

import sys


def input():
    return sys.stdin.readline().strip()


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


n, a, b = MAP()
print(
    (
        abs(a - b) // 2
        if not (a - b) % 2
        else abs(a - b) // 2 + min(min(a, b) - 1, n - max(a, b)) + 1
    )
)

-import sys, re, os -from collections import deque, defaultdict, Counter -from math import ( -    ceil, -    sqrt, -    hypot, -    factorial, -    pi, -    sin, -    cos, -    radians, -    acos, -    atan, -    asin, -    log, -    log10, -) -from itertools import permutations, combinations, product, accumulate -from operator import itemgetter, mul -from copy import deepcopy -from string import ascii_lowercase, ascii_uppercase, digits -from fractions import gcd - - -def debug(*args): -    if debugmode: -        print((*args)) +import sys -def STR(): -    return eval(input()) - - -def INT(): -    return int(eval(input())) - - -def FLOAT(): -    return float(eval(input())) - - -def S_MAP(): -    return list(map(str, input().split())) - - -def LIST(): -    return list(map(int, input().split())) - - -def S_LIST(): -    return list(map(str, input().split())) - - -def lcm(a, b): -    return a * b // gcd(a, b) - - -sys.setrecursionlimit(10**9) -inf = sys.maxsize -mod = 10**9 + 7 -dx = [0, 0, 1, -1, 1, -1, -1, 1] -dy = [1, -1, 0, 0, 1, -1, 1, -1] -debugmode = True