local x, y = io.read("*n", "*n")
if 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
