import numpy as np



if __name__ == '__main__':

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

    res = 1000000000000

    ax, ay = (abs(x), abs(y))

    if x <= y:

        res = min(res, y-x)

    if x * y <= 0:

        res = min(res, abs(ax-ay)+1)

    else:

        res = min(res, abs(ax-ay)+2)

    print(res)



x,y = [int(it) for it in input().split()]



s = 1000000001



ds = y-x

if (ds>=0):

  s = min(s,ds)

ds = y+x

if (ds>=0):

  s = min(s,1+ds)

ds = -y-x

if (ds>=0):

  s = min(s,1+ds)

ds = -y+x

if (ds>=0):

  s = min(s,2+ds)

print (s)

  

import numpy as np

if __name__ == "__main__":
    x, y = list(map(int, input().split()))
    res = 1000000000000
    ax, ay = (abs(x), abs(y))
    if x <= y:
        res = min(res, y - x)
    if x * y <= 0:
        res = min(res, abs(ax - ay) + 1)
    else:
        res = min(res, abs(ax - ay) + 2)
    print(res)

x, y = [int(it) for it in input().split()]
s = 1000000001
ds = y - x
if ds >= 0:
    s = min(s, ds)
ds = y + x
if ds >= 0:
    s = min(s, 1 + ds)
ds = -y - x
if ds >= 0:
    s = min(s, 1 + ds)
ds = -y + x
if ds >= 0:
    s = min(s, 2 + ds)
print(s)

-import numpy as np - -if __name__ == "__main__": -    x, y = list(map(int, input().split())) -    res = 1000000000000 -    ax, ay = (abs(x), abs(y)) -    if x <= y: -        res = min(res, y - x) -    if x * y <= 0: -        res = min(res, abs(ax - ay) + 1) -    else: -        res = min(res, abs(ax - ay) + 2) -    print(res) +x, y = [int(it) for it in input().split()] +s = 1000000001 +ds = y - x +if ds >= 0: +    s = min(s, ds) +ds = y + x +if ds >= 0: +    s = min(s, 1 + ds) +ds = -y - x +if ds >= 0: +    s = min(s, 1 + ds) +ds = -y + x +if ds >= 0: +    s = min(s, 2 + ds) +print(s)