#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long x, y;
  cin >> x >> y;
  if (x < y) {
    cout << y - x << endl;
  } else {
    if (y >= 0 && x > y)
      cout << x + y + 1 << endl;
    else if (y < x && x <= 0) {
      if (x == 0) cout << llabs(y) - llabs(x) + 1 << endl;
      ;
      if (x != 0) cout << llabs(y) - llabs(x) + 2 << endl;
    } else {
      if (llabs(y) >= llabs(x)) {
        cout << llabs(y) - llabs(x) + 1 << endl;
      } else {
        cout << llabs(x) - llabs(y) + 1 << endl;
        ;
      }
    }
  }
  return 0;
}
