#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  int x,y;
  cin>>x>>y;
  int ans=INT_MAX;
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      int a=i?-x:x, b=j?-y:y;
      if(a<=b) ans=min(ans,i+j+b-a);
    }
  }
  cout<<ans<<endl;
  return 0;
}