import std.algorithm;
import std.stdio;

int solve (int a, int b)
{
	return a <= b ? b - a : int.max - 20;
}

int solveAll (int a, int b)
{
	return min (solve (+a, +b) + 0,
	    solve (+a, -b) + 1, solve (-a, +b) + 1, solve (-a, -b) + 2);
}

void main ()
{
	int a, b;
	while (readf (" %s %s", &a, &b) > 0)
	{
		writeln (solveAll (a, b));
	}
}
