import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)



x,y = list(map(int,input().split()))

answer = 10 ** 18

if x <= y:

    answer = min(answer, y-x)

if -x <= y:

    answer = min(answer, 1+x+y)

if x <= -y:

    answer = min(answer, 1-y-x)

if -x <= -y:

    answer = min(answer, 2+x-y)

print(answer)
import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



# 符号の反転は最初と最後以外にない



x,y = list(map(int,read().split()))



cand = []

if x <= y:

    cand.append(y-x)

if (-x) <= y:

    cand.append(1 + x + y)

if x <= (-y):

    cand.append(1 - x - y)

if (-x) <= (-y):

    cand.append(2 - y + x)



answer = min(cand)

print(answer)
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
x, y = list(map(int, input().split()))
answer = 10**18
if x <= y:
    answer = min(answer, y - x)
if -x <= y:
    answer = min(answer, 1 + x + y)
if x <= -y:
    answer = min(answer, 1 - y - x)
if -x <= -y:
    answer = min(answer, 2 + x - y)
print(answer)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# 符号の反転は最初と最後以外にない
x, y = list(map(int, read().split()))
cand = []
if x <= y:
    cand.append(y - x)
if (-x) <= y:
    cand.append(1 + x + y)
if x <= (-y):
    cand.append(1 - x - y)
if (-x) <= (-y):
    cand.append(2 - y + x)
answer = min(cand)
print(answer)

-input = sys.stdin.readline -sys.setrecursionlimit(10**7) -x, y = list(map(int, input().split())) -answer = 10**18 +read = sys.stdin.buffer.read +readline = sys.stdin.buffer.readline +readlines = sys.stdin.buffer.readlines +# 符号の反転は最初と最後以外にない +x, y = list(map(int, read().split())) +cand = [] -    answer = min(answer, y - x) -if -x <= y: -    answer = min(answer, 1 + x + y) -if x <= -y: -    answer = min(answer, 1 - y - x) -if -x <= -y: -    answer = min(answer, 2 + x - y) +    cand.append(y - x) +if (-x) <= y: +    cand.append(1 + x + y) +if x <= (-y): +    cand.append(1 - x - y) +if (-x) <= (-y): +    cand.append(2 - y + x) +answer = min(cand)