#include<bits/stdc++.h>
using namespace std;
#define RI register int
int x,y;
int main()
{
	scanf("%d%d",&x,&y);
	if(x==y) puts("0");
	else if(y>x) printf("%d\n",min(y-x,abs(y+x)+1));
	else printf("%d\n",min(abs(x+y)+1,2+abs(x-y)));
	return 0;
}