{-# LANGUAGE MultiWayIf #-}

import Control.Applicative
import Control.Monad
import Data.List

solve :: Int -> Int -> Int
solve x y
    | ax == ay = if
        | x == y    -> 0
        | otherwise -> 1
    | ax <  ay = if
        | x >  0    -> btnA + btnB (x + btnA) y
        | otherwise -> 1 + btnA + btnB (negate $ x - btnA) y
    | ax >  ay = if
        | x <  0    -> btnA + btnB (x + btnA) y
        | otherwise -> 1 + btnA + btnB (negate $ x - btnA) y
  where
    ax = abs x
    ay = abs y
    btnA = abs (x - y)
    btnB i j | i == j    = 0
             | otherwise = 1

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