import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    long x, y;
    scan(x, y);
    // x = 10;
    // y = 20;
    () {
        long ans = long.max;
        foreach (b0; 0 .. 2)
            foreach (b1; 0 .. 2)
            {
                long X = x;
                long Y = y;
                if (b0)
                    X = -X;
                if (b1)
                    Y = -Y;
                // writefln("%d %d %d %d", b0, b1, X, Y);
                if (X <= Y)
                    ans = ans.min(Y - X + b0 + b1);
            }
        return ans;
    }().writeln();
}
