import sys

import numpy as np





def input():

    return sys.stdin.readline().strip()





sys.setrecursionlimit(10 ** 9)





def main():

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

    if x > 0:

        if y > 0:

            if x > y:

                answer = x - y + 2

            else:

                answer = y - x

        elif y == 0:

            answer = x + 1

        else:

            if -x <= y:

                answer = y + x + 1

            else:

                answer = abs(y) - x + 1

    elif x == 0:

        if y > 0:

            answer = y

        else:

            answer = -y + 1

    else:

        if y > 0:

            if abs(x) >= y:

                answer = abs(x) - y + 1

            else:

                answer = y - abs(x) + 1

        elif y == 0:

            answer = abs(x)

        else:

            if abs(x) > abs(y):

                answer = abs(x) - abs(y)

            else:

                answer = abs(y) - abs(x) + 2

    print(answer)





if __name__ == "__main__":

    main()

import sys





def input():

    return sys.stdin.readline().strip()





sys.setrecursionlimit(20000000)





def main():

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

    if x == y:

        print((0))

        return

    if x == 0:

        if y < 0:

            print((abs(y) + 1))

            return

        else:

            print(y)

            return

    if x < 0:

        if y > 0:

            if abs(x) < y:

                print((y - abs(x) + 1))

                return

            else:

                print((abs(x) - y + 1))

                return

        elif y == 0:

            print((abs(x)))

            return

        else:

            if x > y:

                print((x - y + 2))

                return

            else:

                print((y - x))

                return

    else:

        if y > 0:

            if x < y:

                print((y - x))

                return

            else:

                print((x - y + 2))

                return

        elif y == 0:

            print((x + 1))

            return

        else:

            if x < abs(y):

                print((abs(y) - x + 1))

                return

            else:

                print((x - abs(y) + 1))







if __name__ == "__main__":

    main()

import sys
import numpy as np


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


sys.setrecursionlimit(10**9)


def main():
    x, y = list(map(int, input().split()))
    if x > 0:
        if y > 0:
            if x > y:
                answer = x - y + 2
            else:
                answer = y - x
        elif y == 0:
            answer = x + 1
        else:
            if -x <= y:
                answer = y + x + 1
            else:
                answer = abs(y) - x + 1
    elif x == 0:
        if y > 0:
            answer = y
        else:
            answer = -y + 1
    else:
        if y > 0:
            if abs(x) >= y:
                answer = abs(x) - y + 1
            else:
                answer = y - abs(x) + 1
        elif y == 0:
            answer = abs(x)
        else:
            if abs(x) > abs(y):
                answer = abs(x) - abs(y)
            else:
                answer = abs(y) - abs(x) + 2
    print(answer)


if __name__ == "__main__":
    main()

import sys


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


sys.setrecursionlimit(20000000)


def main():
    x, y = list(map(int, input().split()))
    if x == y:
        print((0))
        return
    if x == 0:
        if y < 0:
            print((abs(y) + 1))
            return
        else:
            print(y)
            return
    if x < 0:
        if y > 0:
            if abs(x) < y:
                print((y - abs(x) + 1))
                return
            else:
                print((abs(x) - y + 1))
                return
        elif y == 0:
            print((abs(x)))
            return
        else:
            if x > y:
                print((x - y + 2))
                return
            else:
                print((y - x))
                return
    else:
        if y > 0:
            if x < y:
                print((y - x))
                return
            else:
                print((x - y + 2))
                return
        elif y == 0:
            print((x + 1))
            return
        else:
            if x < abs(y):
                print((abs(y) - x + 1))
                return
            else:
                print((x - abs(y) + 1))


if __name__ == "__main__":
    main()

-import numpy as np -sys.setrecursionlimit(10**9) +sys.setrecursionlimit(20000000) -    if x > 0: +    if x == y: +        print((0)) +        return +    if x == 0: +        if y < 0: +            print((abs(y) + 1)) +            return +        else: +            print(y) +            return +    if x < 0: +            if abs(x) < y: +                print((y - abs(x) + 1)) +                return +            else: +                print((abs(x) - y + 1)) +                return +        elif y == 0: +            print((abs(x))) +            return +        else: -                answer = x - y + 2 +                print((x - y + 2)) +                return -                answer = y - x -        elif y == 0: -            answer = x + 1 -        else: -            if -x <= y: -                answer = y + x + 1 -            else: -                answer = abs(y) - x + 1 -    elif x == 0: -        if y > 0: -            answer = y -        else: -            answer = -y + 1 +                print((y - x)) +                return -            if abs(x) >= y: -                answer = abs(x) - y + 1 +            if x < y: +                print((y - x)) +                return -                answer = y - abs(x) + 1 +                print((x - y + 2)) +                return -            answer = abs(x) +            print((x + 1)) +            return -            if abs(x) > abs(y): -                answer = abs(x) - abs(y) +            if x < abs(y): +                print((abs(y) - x + 1)) +                return -                answer = abs(y) - abs(x) + 2 -    print(answer) +                print((x - abs(y) + 1))