#include <bits/stdc++.h>
using namespace std;
const bool input = 1;
long long binpow(long long a, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 1) {
    long long b = binpow(a, n - 1) % 1000000009;
    return (b * a) % 1000000009;
  } else {
    long long b = binpow(a, n / 2) % 1000000009;
    return (b * b) % 1000000009;
  }
}
bool cmp(string s, string t) {
  if (s.length() < t.length()) {
    return true;
  }
  if (s.length() > t.length()) {
    return false;
  }
  for (long long i = 0; i < s.length(); ++i) {
    if (s[i] > t[i]) {
      return false;
    }
    if (s[i] < t[i]) {
      return true;
    }
  }
  return true;
}
bool next(string &a, string &b) {
  if (b.length() - a.length() > 1) {
    return false;
  }
  if (a.length() == b.length()) {
    vector<char> c(b.length());
    long long j = b.length() - 1;
    while (j >= 0 && b[j] == 'a') {
      c[j] = 'z';
      --j;
    }
    if (j < 0) {
      return false;
    }
    c[j] = (char)(b[j] - 1);
    cout << "c!!!" << c[j] << "\n";
    for (long long i = 0; i < j; ++i) {
      c[i] = b[i];
    }
    vector<char> aa(a.length());
    for (long long k = 0; k < a.length(); ++k) {
      aa[k] = a[k];
    }
    if (c == aa) {
      return true;
    }
    return false;
  }
  for (long long i = 0; i < a.length(); ++i) {
    if (a[i] != 'z') {
      return false;
    }
  }
  for (long long i = 0; i < b.length(); ++i) {
    if (b[i] != 'a') {
      return false;
    }
  }
  return true;
}
vector<char> prev(string &b) {
  long long t = b.length();
  vector<char> c(t);
  long long j = t - 1;
  while (j >= 0 && b[j] == 'a') {
    c[j] = 'z';
    --j;
  }
  if (j < 0) {
    vector<char> ans(t - 1);
    for (long long i = 0; i < t - 1; ++i) {
      ans[i] = 'z';
    }
    return ans;
  }
  c[j] = (char)(b[j] - 1);
  for (long long i = 0; i < j; ++i) {
    c[i] = b[i];
  }
  return c;
}
long long n, t[4 * 10 * 1000];
void build(long long a[], long long v, long long tl, long long tr) {
  if (tl == tr)
    t[v] = a[tl];
  else {
    long long tm = (tl + tr) / 2;
    build(a, v * 2, tl, tm);
    build(a, v * 2 + 1, tm + 1, tr);
    t[v] = t[v * 2] + t[v * 2 + 1];
  }
}
long long sum(long long v, long long tl, long long tr, long long l,
              long long r) {
  if (l > r) return 0;
  if (l == tl && r == tr) return t[v];
  long long tm = (tl + tr) / 2;
  return sum(v * 2, tl, tm, l, min(r, tm)) +
         sum(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);
}
int main() {
  long long m, i, j, k, q, l, r, x, y;
  if (input) {
  }
  cin >> x >> y;
  int cnt = 0;
  while (x != 0 || y != 0) {
    if (x > 0 && y <= x && y > -x + 1) {
      y = -x + 1;
    } else {
      if (x < 0 && y < -x && y >= x) {
        y = -x;
      } else {
        if (y > 0 && x >= -y && x < y) {
          x = y;
        } else {
          if (y < 0 && x > y && -y + 1 >= x) {
            x = y;
          } else {
            if (x == 1 && y == 0) {
              x = 0;
              y = 0;
            }
          }
        }
      }
    }
    ++cnt;
  }
  cout << max(cnt - 1, 0);
}
