solve x y
  | x == y = 0
  | x' == y' = 1
  | y >= x = y - x
  | y >= 0 = 1 + (y - x)
  | otherwise = 1 + (y' - x') + 1
  where
    x' = abs x
    y' = abs y

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