program prob3
    implicit none
    integer(8) :: n, a, b, ans
    read(*,*) n,a,b
    if(mod(a+b, 2) == 0) then
        ans = (b-a) / 2
    else
        ans = min(2*n - (a+b) + 1, a+b-1)
        ans = ans / 2
    end if
    write(*,*) ans
    stop
contains
end program prob3