program example
	implicit none
    
    integer(16) A,B,N
    
    read(*,*) N,A,B
    
    if(mod(B-A,2)==0) then
    
    	write(*,*)  (B-A)/2
            
    else
 		write(*,*) min(N-B,A-1)+1+((B-A-1)/2)
    end if

end program example