      PROGRAM tableTennisTraining
      IMPLICIT NONE
      integer(16) :: n,a,b
      integer(16) :: sub,ans
      
      read*,n,a,b
      
      !base
      sub = abs( a-b )
      ans = sub/2 + (sub - (sub/2)*2)
      
      !ex
      if( a-1<=ans .and. b-1<=ans )then
        ans = max(a-1,b-1)
      end if
      
      if( n-a<=ans .and. n-b<=ans )then
        ans = max(n-a,n-b)
      end if
      
      
      
      print*,ans
      
      
      END PROGRAM