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