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

int main() {
    ll x, y;
    cin >> x >> y;
    ll ans = 9999999999;
    if (y >= x) ans = min(ans, y-x);
    if (-y >= x) ans = min(ans, 1-y-x);
    if (y >= -x) ans = min(ans, 1+y+x);
    if (-y >= -x) ans = min(ans, 2-y+x);
    cout << ans << endl;
}