#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const long long INFLL = 1e18;
int dx[4] = {0, -1, 1, 0}, dy[4] = {-1, 0, 0, 1};
int main() {
  ios::sync_with_stdio(false);
  int X, Y;
  cin >> X >> Y;
  int ans = INF;
  if (abs(X) == abs(Y)) {
    ans = 1;
  }
  if (-X < Y) {
    ans = min(ans, 1 + Y - (-X));
    cerr << "A" << endl;
    cerr << "ans"
         << "=" << ans << endl;
  }
  if (X < -Y) {
    ans = min(ans, (-Y) - X + 1);
    cerr << "B" << endl;
    cerr << "ans"
         << "=" << ans << endl;
  }
  if (X < Y) {
    ans = min(ans, Y - X);
    cerr << "C" << endl;
    cerr << "ans"
         << "=" << ans << endl;
  }
  if (-X < -Y) {
    ans = min(ans, (-Y) - (-X) + 2);
    cerr << "D" << endl;
    cerr << "ans"
         << "=" << ans << endl;
  }
  cout << ans << endl;
}
