#include <iostream>
#include <algorithm>
using namespace std;
const long long inf = 1LL << 62;
int main() {
	long long X, Y;
	cin >> X >> Y;
	long long ans = inf;
	if(X <= Y) ans = min(ans, Y - X);
	else ans = min(ans, X - Y + 2);
	if(-X <= Y) ans = min(ans, Y - (-X) + 1);
	else ans = min(ans, (-X) - Y + 1);
	cout << ans << endl;
	return 0;
}