#import <stdio.h>
int main() {
	long a,b;
	scanf("%ld %ld",&a,&b);
	long ans;
	if(a>=0&&b>0){
		ans = (b>=a)?b-a:a-b+2;
	}else if(a<0&&b>0){
		ans = (b>=-a)?1+b+a:-b-a+1;
	}else if(a<0&&b<0){
		ans = (b>=a)?b-a:-b+a+2;
	}else if(a>0&&b<0){
		ans = (-b>=a)?-b-a+1:b+a+1;
	}else if(a<0&&b==0){
		ans = -a;
	}else if(a==0&&b<0){
		ans = -b+1;
	}else if(a>0&&b==0){
		ans = a+1;
	}
	printf("%ld\n",ans);
}
