#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
int main(){
  uli x,y;
  cin>>x>>y;
  uli ans=1e18;
  if(x<=y)ans=min(ans,y-x);
  if(-x-y>=0)ans=min(ans,-x-y+1);
  if(x-y>=0)ans=min(ans,x-y+2);
  if(y+x>=0)ans=min(ans,y+x+1);
  cout<<ans<<endl;
  return 0;
}
