! 2019.12.28 
!
      program answer
      implicit none
      integer(8) :: N
      integer(8) :: A,B
      integer(8) :: large
      integer(8) :: small
      integer(8) :: step
      integer(8) :: dif
      integer(8) :: ans
      intrinsic mod,abs
!
      read(*,*) N,A,B
      if(mod(abs(A-B),2) == 0) then
        ans = abs(A-B)/2
      else
        if(A > B) then
          large = A
          small = B
        else
          large = B
          small = A
        end if
        if(N-large < small-1) then
          step = N-large
        else
          step = small-1
        end if
        dif = large - small
        ans = step + dif/2 + 1
      end if
      write(*,*) ans
      end program answer