#include <bits/stdc++.h>
using namespace std;

int main(){
  int x,y; cin>>x>>y;

  if(((x>=0 && y>=0)||(x<=0 && y<=0)) && x<=y)cout<<y-x<<endl;
  else if((x>=0 && y<=0)||(x<=0 && y>=0))cout<<abs(abs(x)-abs(y))+1<<endl;
  else cout<<x-y+2<<endl;
}