import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [x,y] <- getIntList
    let ans | x <= y = abs (y - x)
            | x > y && (y > 0 || x < 0) = abs (x - y) + 2
            | otherwise = abs (x - abs y) + 1
    print ans