import Control.Monad
import Data.Maybe
import Data.Char
import Data.List (unfoldr)
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

--Input functions with ByteString
readInt = fst . fromJust . BS.readInt
readIntTuple = tuplify2 . map readInt . BS.words
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntN n = map readInt <$> replicateM (fromIntegral n) BS.getLine
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents


main = do
  [x,y] <- getIntList

  -- 最初: しない 最後: しない
  let d1 = y - x
  -- 最初: する 最後: しない
  let d2 = y + x + 1
  -- 最初: しない 最後: する
  let d3 = - y - x + 1
  -- 最初: する 最後: する
  let d4 = - y + x + 2
  print $ minimum $ filter (\n -> n > 0) [d1,d2,d3,d4]