#include <iostream>
#include <cmath>
using namespace std;

int sign(int x){
  return (x>0)-(x<0);
}
int main(){
  int x,y;
  int count = 0;
  cin >> x >> y;
  
  if( sign(x)*sign(y)==1 ){
    if( x<y ) cout << y-x << endl;
    if( x>y ) cout << x-y+2 << endl;
  }
  if( sign(x)*sign(y)==-1 ){
    if( sign(x)*x<=sign(y)*y ) cout << sign(y)*y-sign(x)*x+1 << endl;
    if( sign(x)*x>sign(y)*y ) cout << sign(x)*x-sign(y)*y+1 << endl;
  }
  if( x*y==0 ){
    if( x<y ) cout << y-x << endl;
    if( x>y ) cout << x-y+1 << endl;
  }
}
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)

lli x, y;

int main(void){
	cin >> x >> y;
	lli ans = 1e18;
	rep(i, 2){
		rep(j, 2){
			lli xc, yc;
			xc = x;
			yc = y;
			lli c = 0;
			if(i == 1) xc*=-1, c++;
			if(j == 1) yc*=-1, c++;
			if(xc <= yc) c+=yc-xc;
			else c+=1e18;
			ans = min(ans, c);
		}
	}
	cout << ans << endl;
	return 0;
}
