program AGC41_A
  integer(8)::N,A,B
  read(*,*)N,A,B
  if((B-A)/2*2==B-A) then
     write(*,*)(B-A)/2
  else
     if(B-A==1) then
        if(A+B<2*N-A-B+2) then
           write(*,*)A
        else
           write(*,*)N-B+1
        end if
        go to 10
     end if
     if(A+B<2*N-A-B+2) then
        write(*,*)(A+B-1)/2
     else
        write(*,*)(2*N-A-B+1)/2
     end if
 10 end if
end program AGC41_A