#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
namespace {
int sign(int src) { return src >= 0 ? 1 : -1; }
}  // namespace
void AGC008A() {
  int X, Y;
  cin >> X >> Y;
  int ct = 0;
  if (sign(X) * sign(Y) >= 0) {
    if (X > Y) {
      ++ct;
      ct += X - Y;
      if (X * Y != 0) ++ct;
    } else {
      ct = Y - X;
    }
  } else {
    ct = abs(abs(X) - abs(Y)) + 1;
  }
  cout << ct << endl;
}
int main() {
  AGC008A();
  return 0;
}
