import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getl (map read . words) >>= print

solve :: [Int] -> Int
solve [x, y]
  | (abs x) <= (abs y) = if x >= 0 && y >= 0 then d
                         else if x < 0 && y < 0 then d + 2
                              else d + 1
  | otherwise = if x < 0 && y < 0 then d
                else if x >= 0 && y >= 0 then d + 2
                     else d + 1
    
  where
    d = abs ((abs x) - (abs y))

getl :: (String -> a) -> IO a
getl f = f <$> getLine
