#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main(void) {
  int a, b;
  scanf("%d%d", &a, &b);
  int ans = abs(b - a) + 2;
  ans = min(ans, abs(b + a) + 1);
  if (b >= a) ans = min(ans, b - a);
  printf("%d\n", ans);
  return 0;
}
