#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>

using namespace std;
int n,m,a,b,c;
int main()
{
    cin>>n>>m;
if(n==m){
cout<<0;
return 0;
}
if(abs(m)==abs(n))
{
cout<<1;
 return 0;
}
if(n>m&&n>0&&m>0)
{
    cout<<m+n+1;
    return 0;
}
if(n>m&&n<0&&m<0)
{
    n=n*-1;
    b=m*-1;
    cout<<b-n+2;
    return 0;
}
if(n>m&&n>0&&m<0 && n>abs(m))
{
    n=n*-1;
    cout<<m-n+1;
    return 0;
}
if(n<m)
{
    cout<<m-n;
    return 0;
}
if(n>m&&n>0&&m<0 && n<abs(m))
{
    n=n*-1;
    cout<<abs(m)+n+1;
    return 0;
}



}
