#include <bits/stdc++.h>
using namespace std;

const int INF = 2.1e9;

int signum(int x) {
	return x < 0 ? -1 : (x > 0);
}

int main() {
	int x, y;
	cin >> x >> y;
	int ans = INF;
	if (x < y) ans = y-x;
	if (signum(x)*signum(y) <= 0) {
		ans = min(ans, abs(x+y)+1);
	} else {
		ans = min(ans, abs(x-y)+2);
	}
	printf("%d\n", ans);

	return 0;
}
