import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    int x, y;
    scan(x, y);

    int ans;

    if (1L * x * y != 0) {
        if (0 < x && x < y) ans = y - x;
        else if (0 < y && y < x) ans = x - y + 2;
        else if (x < y && y < 0) ans = y - x;
        else if (y < x && x < 0) ans = x - y + 2;
        else if (x < 0 && 0 < y && abs(x) < abs(y)) ans = y + x + 1;
        else if (x < 0 && 0 < y && abs(x) == abs(y)) ans = 1;
        else if (x < 0 && 0 < y && abs(x) > abs(y)) ans = -y - x + 1;
        else if (y < 0 && 0 < x && abs(x) < abs(y)) ans = -y - x + 1;
        else if (y < 0 && 0 < x && abs(x) == abs(y)) ans = 1;
        else if (y < 0 && 0 < x && abs(x) > abs(y)) ans = y + x + 1;
    }
    else {
        if (x == 0) {
            ans = (y > 0 ? y : abs(y) + 1);
        }
        else {
            ans = (x > 0 ? x + 1 : abs(x));
        }
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}