#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using vi=vector<int>;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x,y;
    ll cnt=0;
    cin >> x >> y;
    if(x>=0 && y>=0){
        if(x>y){
            x=0-x;
            ++cnt;
            while(1){
                if(abs(x)==abs(y)) break;
                ++x; ++cnt;
            }
            if(y!=0) ++cnt;
        }else{
            while(1){
                if(x==y) break;
                ++x; ++cnt;
            }
        }
    }else if(x<0 && y<0){
        if(abs(x)>=abs(y)){
            while(1){
                if(x==y) break;
                ++x; ++cnt;
            }
        }else{
            x=0-x;
            ++cnt;
            while(1){
                if(abs(x)==abs(y)) break;
                ++x; ++cnt;
            }
            ++cnt;
        }
    }else if(x<0 && y>=0){
        if(abs(x)<=abs(y)){
            x=0-x;
            ++cnt;
        }
        while(1){
            if(abs(x)==abs(y)) break;
            ++x; ++cnt;
        }
        if(x!=y) ++cnt;
    }else if(x>=0 && y<0){
        if(abs(x)<abs(y)){
            while(1){
                if(abs(x)==abs(y)) break;
                ++x; ++cnt;
            }
            ++cnt;
        }else{
            x=0-x;
            ++cnt;
            while(1){
                if(x==y) break;
                ++x; ++cnt;
            }    
        }
    }
    cout << cnt << "\n";
    return 0;
}   
#include <bits/stdc++.h>
using namespace std;

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;


int main() {
    ll a, b; cin >> a >> b;

    if(a == 0){
        if(b < 0) cout << abs(b) + 1 << endl;
        else cout << abs(b) << endl;
    }else if(b == 0){
        if(a < 0) cout << abs(a) << endl;
        else cout << abs(a) + 1 << endl;
    }else if(0 < a && 0 < b){
        if(a < b){
            cout << b - a << endl;
        }else{
            cout << abs(b - a) + 2 << endl;
        }
    }else if(a < 0 && b < 0){
        if(abs(a) < abs(b)){
            cout << abs(b) - abs(a) + 2 << endl;
        }else{
            cout << abs(a) - abs(b) << endl;
        }
    }else if(a < 0 && 0 < b){
        if(abs(a) < b){
            cout << b - abs(a) + 1 << endl;
        }else{
            cout << abs(a) - b + 1 << endl;
        }
    }else if(0 < a && b < 0){
        if(a < abs(b)){
            cout << abs(b) - a + 1 << endl;
        }else{
            cout << a - abs(b) + 1 << endl;
        }
    }

    return 0;
}
