let x, y =
  let l = stdin.ReadLine().Split(' ') |> Array.map int
  l.[0], l.[1]

let ans =
  if y = 0 then
    if x < 0 then (abs x) else (abs x) + 1
  else
    if (abs x) = (abs y) then
      1
    elif x = 0 then
      if y > 0 then
        y
      else
        -y + 1
    elif x < -(abs y) then
      if y > 0 then
        abs (-(abs y) - x) + 1
      else
        abs (-(abs y) - x)
    elif x > abs y then
      if y > 0 then
        abs (-(abs y) - (-x)) + 2
      else
        abs (-(abs y) - (-x)) + 1
    elif x < 0 then
      if y > 0 then
        abs (abs y - abs x) + 1
      else
        abs (abs y - abs x) + 2
    else
      if y > 0 then
        abs (abs y - abs x)
      else
        abs (abs y - abs x) + 1

ans |> stdout.WriteLine