#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
using namespace std;
int main(int argc, char const* argv[]) {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  if (a <= b) {
    ans = b - a;
  } else {
    if (a > 0 && b <= 0) {
      ans = abs(a + b) + 1;
    } else {
      ans = abs(a - b) + 2;
    }
  }
  cout << ans << std::endl;
  return 0;
}
