program A_Table_Tennis_Training
    implicit none
    integer(16)::n,a,b,ans
    read*,n,a,b
    if (mod(b-a-1,2) == 0) then
        ans = min(b-1,n-a)
    else
        ans = (b-a)/2
    end if 
    print*,ans
end program A_Table_Tennis_Training