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 try a b = if b >= a then b - a else 10^10
    print $ minimum [try x y, try (-x) y + 1, try x (-y) + 1, try (-x) (-y) + 2]