local x, y = io.read("*n", "*n")
if x == 0 then
  if 0 <= y then
    print(y)
  else
    print(1 - y)
  end
elseif y == 0 then
  if 0 < x then
    print(x + 1)
  else
    print(-x)
  end
elseif 0 < x and 0 < y then
  if x <= y then
    print(y - x)
  else
    print(2 + x - y)
  end
elseif x < 0 and 0 < y then
  print(1 + math.abs(x + y))
elseif x < 0 and y < 0 then
  if x <= y then
    print(y - x)
  else
    print(2 + x - y)
  end
else
  print(1 + math.abs(x + y))
end
