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

int main(){
    int x,y;cin>>x>>y;
    int a=x,b=y;
    int ans=2000000001;
    if(a<=b)ans=min(ans,b-a);
    a=-x;
    if(a<=b)ans=min(ans,b-a+1);
    b=-y;
    if(a<=b)ans=min(ans,b-a+2);
    a=x;
    if(a<=b)ans=min(ans,b-a+1);
    cout<<ans<<endl;
    return 0;
}