void main()
{
    long[] tmp = readln.split.to!(long[]);
    long a = tmp[0], b = tmp[1];

    if (a == 0 || b == 0)
    {
        if (a < b) writeln(abs(b.abs-a.abs));
        else writeln(abs(b.abs-a.abs) + 1);
    }
    else if (a / a.abs == b / b.abs)
    {
        if (a <= b) writeln(b - a);
        else writeln(a - b + 2);
    }
    else
    {
        writeln(abs(b.abs-a.abs) + 1);
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;