# -*- coding: utf-8 -*-



import sys, re

from collections import deque, defaultdict, Counter

from math import sqrt, hypot, factorial, pi, sin, cos, radians

if sys.version_info.minor >= 5: from math import gcd

else: from fractions import gcd 

from heapq import heappop, heappush, heapify, heappushpop

from bisect import bisect_left, bisect_right

from itertools import permutations, combinations, product

from operator import itemgetter, mul

from copy import deepcopy

from functools import reduce, partial

from fractions import Fraction

from string import ascii_lowercase, ascii_uppercase, digits



def input(): return sys.stdin.readline().strip()

def ceil(a, b=1): return int(-(-a // b))

def round(x): return int((x*2+1) // 2)

def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD

def lcm(x, y): return (x * y) // gcd(x, y)

def lcm_list(nums): return reduce(lcm, nums, 1)

def gcd_list(nums): return reduce(gcd, nums, nums[0])

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(): return list(map(int, input().split()))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

MOD = 10 ** 9 + 7



x, y = MAP()



if x <= y:

    ans = min(y - x, abs(abs(x)-abs(y))+1)

else:

    if x > 0 and y > 0 or x < 0 and y < 0:

        ans = x - y + 2

    else:

        ans = abs(abs(x)-abs(y))+1

print(ans)

# -*- coding: utf-8 -*-



"""

・自力AC

"""



import sys, re

from collections import deque, defaultdict, Counter

from math import sqrt, hypot, factorial, pi, sin, cos, radians

if sys.version_info.minor >= 5: from math import gcd

else: from fractions import gcd 

from heapq import heappop, heappush, heapify, heappushpop

from bisect import bisect_left, bisect_right

from itertools import permutations, combinations, product

from operator import itemgetter, mul

from copy import deepcopy

from functools import reduce, partial

from fractions import Fraction

from string import ascii_lowercase, ascii_uppercase, digits



def input(): return sys.stdin.readline().strip()

def ceil(a, b=1): return int(-(-a // b))

def round(x): return int((x*2+1) // 2)

def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD

def lcm(x, y): return (x * y) // gcd(x, y)

def lcm_list(nums): return reduce(lcm, nums, 1)

def gcd_list(nums): return reduce(gcd, nums, nums[0])

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(): return list(map(int, input().split()))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

MOD = 10 ** 9 + 7



x, y = MAP()



# x, yの大小、正負をまたぐかどうかで場合分け

if x <= y:

    if x >= 0 or y <= 0:

        ans = y - x

    else:

        ans = abs(abs(x)-abs(y))+1

else:

    if x > 0 and y > 0 or x < 0 and y < 0:

        ans = x - y + 2

    else:

        ans = abs(abs(x)-abs(y))+1

print(ans)

# -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians

if sys.version_info.minor >= 5:
    from math import gcd
else:
    from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits


def input():
    return sys.stdin.readline().strip()


def ceil(a, b=1):
    return int(-(-a // b))


def round(x):
    return int((x * 2 + 1) // 2)


def fermat(x, y, MOD):
    return x * pow(y, MOD - 2, MOD) % MOD


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(nums):
    return reduce(lcm, nums, 1)


def gcd_list(nums):
    return reduce(gcd, nums, nums[0])


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST():
    return list(map(int, input().split()))


sys.setrecursionlimit(10**9)
INF = float("inf")
MOD = 10**9 + 7
x, y = MAP()
if x <= y:
    ans = min(y - x, abs(abs(x) - abs(y)) + 1)
else:
    if x > 0 and y > 0 or x < 0 and y < 0:
        ans = x - y + 2
    else:
        ans = abs(abs(x) - abs(y)) + 1
print(ans)

# -*- coding: utf-8 -*-
"""
・自力AC
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians

if sys.version_info.minor >= 5:
    from math import gcd
else:
    from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits


def input():
    return sys.stdin.readline().strip()


def ceil(a, b=1):
    return int(-(-a // b))


def round(x):
    return int((x * 2 + 1) // 2)


def fermat(x, y, MOD):
    return x * pow(y, MOD - 2, MOD) % MOD


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(nums):
    return reduce(lcm, nums, 1)


def gcd_list(nums):
    return reduce(gcd, nums, nums[0])


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST():
    return list(map(int, input().split()))


sys.setrecursionlimit(10**9)
INF = float("inf")
MOD = 10**9 + 7
x, y = MAP()
# x, yの大小、正負をまたぐかどうかで場合分け
if x <= y:
    if x >= 0 or y <= 0:
        ans = y - x
    else:
        ans = abs(abs(x) - abs(y)) + 1
else:
    if x > 0 and y > 0 or x < 0 and y < 0:
        ans = x - y + 2
    else:
        ans = abs(abs(x) - abs(y)) + 1
print(ans)

+""" +・自力AC +""" +# x, yの大小、正負をまたぐかどうかで場合分け -    ans = min(y - x, abs(abs(x) - abs(y)) + 1) +    if x >= 0 or y <= 0: +        ans = y - x +    else: +        ans = abs(abs(x) - abs(y)) + 1