main = do
    [from_, to_] <- return . map read . words =<< getLine
    let negFrom = negate from_
	neg = from_ < 0
    print $ if neg
      then if negFrom <= to_
	    then to_ - negFrom + 1
	    else if to_ < from_
		    then (negate to_) - negFrom + 2
		    else to_ - from_
      else if from_ <= to_
	    then to_ - from_
	    else if to_ < negFrom
		    then (negate to_) - from_ + 1
		    else to_ - negFrom + 1