      PROGRAM tableTennisTraining
      IMPLICIT NONE
      integer(16) :: n,a,b
      integer(16) :: sub,ans,ans1,ansn
      
      read*,n,a,b
      
      
      
      sub = abs( a-b )
      if( mod(sub,2)==0 )then
        ans = sub/2
      else
        ans1 = max(a-1,b-1)
        ansn = max(n-a,n-b)
        ans = min(ans1,ansn)
      endif
      
      
      
      print*,ans
      
      
      END PROGRAM