#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define pf push_front
#define pii pair <int ,int>
#define all(s) s.begin (), s.end ()

using namespace std;

int main()
{
    int n, m, m1, n1;
    cin >> n >> m;
    m1 = abs(m);
    n1 = abs(n);
    if( m1 == n || n1 == m )
    {
        cout << "1";
        return 0;
    }
    if( n == m ){
        cout << 0;
        return 0;
    }
    if( n >= 0 && m >= 0 && m >= n )
    {
        cout << m - n;
        return 0;
    }
    if( n < 0 && m < 0 && m1 > n1 )
    {
        cout << m1 - n1 + 2;
        return 0;
    }
    if( n < 0 && m >= 0 && m > n1 )
    {
        cout << m1 - n1 + 1;
        return 0;
    }
    if( n1 > m1 && n < 0 && m >= 0 )
    {
        cout << n1 - m1  + 1;
        return 0;
    }
    if( n < 0 && m < 0 && m1 < n1 )
    {
        cout << n1 - m1;
        return 0;
    }
    if( n >= 0 && m >= 0 && n > m )
    {
        cout << n - m + 2;
        return 0;
    }
    if( n >= 0 && m < 0 && n1 > m1 )
    {
        cout << n - m1 + 1;
        return 0;
    }
    if( n >= 0 && m < 0 && n1 < m1 )
    {
        cout << m1 - n + 1;
        return 0;
    }


}
