import Control.Applicative
main = do
  [x,y] <- map read . words <$> getLine :: IO [Int]

  print $ solve x y

  where
    solve x y
      | x == y = 0
      | x < y =
        if x >= 0 then y-x
        else if x < 0 && 0 <= y then if abs x >= abs y then -x-y+1 else min (y-x) (y+x+1)
        else y-x
      | x > y =
        if y >= 0 then 1 + min (x-y+1) (x+y)
        else if y < 0 && 0 <= x then if abs x <= abs y then -y-x+1 else x+y+1
        else x-y+2
