//fold
#ifndef KHALIL
#include <bits/stdc++.h>
#else
#include "header.h"
#endif
#define endl '\n'
#define mp make_pair
#define tostr(x) static_cast<ostringstream&>((ostringstream()<<dec<<x)).str()
#define rep(i,begin,end) for(auto i = begin;i < end;i++)
#define repr(i,begin,end) for(auto i = begin-1;i >= end;i--)
#define pb push_back
#define sz(a) ((int)(a).size())
#define abs(a) ((a) < (0) ? (-1)*(a) : (a))
#define SQ(a) ((a)*(a))
#define eqd(a,b) (abs(a-b)<1e-9)
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename t> t in(t q){cin >> q;return q;}
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v){os << "[";for (int i = 0; i < sz(v); ++i) { os << v[i]; if (i != sz(v) - 1) os << ",";}os << "]";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const map<T, S>& v){for (auto it : v)os << "(" << it.first << ":" << it.second << ")";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const pair<T, S>& v){os << "(" << v.first << "," << v.second << ")";return os;}
template <typename F,typename S,typename T>class ayoub{public:F first;S second;T third;constexpr ayoub(): first(F()),second(S()),third(T()) {}constexpr ayoub(const F& f,const S& s,const T& t) :first(f),second(s),third(t) {}template <class E,class R,class Y>constexpr ayoub(const E&& f,const R&& s,const Y&& t){first = f;second = s;third = t;}template <class E,class R,class Y>constexpr ayoub(const ayoub<E,R,Y>& f){first = f.first;second = f.second;third = f.third;}template <class E,class R,class Y>constexpr ayoub(const ayoub<E,R,Y>&& f){first = f.first;second = f.second;third = f.third;}ayoub(const ayoub& p) = default;ayoub(ayoub&& p) = default;constexpr ayoub& operator=(const ayoub& other){first = other.first;second = other.second;third = other.third;return *this;}template<class E,class R,class Y>constexpr ayoub& operator=(const ayoub<E,R,Y>& other){first = other.first;second = other.second;third = other.third;return *this;}constexpr ayoub& operator=(ayoub&& other) noexcept {first = other.first;second = other.second;third = other.third;return *this;}template<class E,class R,class Y>constexpr ayoub& operator=(ayoub<E,R,Y>&& other){first = other.first;second = other.second;third = other.third;return *this;}friend void swap(ayoub<F,S,T> &a, ayoub<F,S,T> &b) {swap(a.first,b.first);swap(a.second,b.second);swap(a.third,b.third);}bool operator==(const ayoub<F,S,T>& o) const{return first == o.first && second == o.second && third == o.third;}bool operator!=(const ayoub<F,S,T>& o) const{return first != o.first || second != o.second || third != o.third;}bool operator<(const ayoub<F,S,T>& o) const{if(first == o.first){if(second == o.second)return third < o.third;return second < o.second;}return first < o.first;}bool operator<=(const ayoub<F,S,T>& o) const{return (*this < o) || (*this == o);}bool operator>(const ayoub<F,S,T>& o) const{return !(*this <= o);}bool operator>=(const ayoub<F,S,T>& o) const{return !(*this < o);}};template <typename F,typename S,typename T>ayoub<F,S,T> make_ayoub(F f,S s,T t){ayoub<F,S,T> ans;ans.first = f;ans.second = s;ans.third = t;return ans;};
template <typename F,typename S,typename T>ostream& operator<<(ostream& os, const ayoub<F,S,T>& v){os << "(" << v.first << "," << v.second << "," << v.third << ")";return os;}
template <typename F,typename S,typename T,typename L>class kilani{public:F first;S second;T third;L fourth;constexpr kilani(): first(F()),second(S()),third(T()),fourth(L()) {}constexpr kilani(const F& f,const S& s,const T& t,const L& l) :first(f),second(s),third(t),fourth(l) {}template <class E,class R,class Y,class X>constexpr kilani(const E&& f,const R&& s,const Y&& t, const X&& x){first = f;second = s;third = t;fourth = x;}template <class E,class R,class Y,class X>constexpr kilani(const kilani<E,R,Y,X>& f){first = f.first;second = f.second;third = f.third;fourth = f.fourth;}template <class E,class R,class Y,class X>constexpr kilani(const kilani<E,R,Y,X>&& f){first = f.first;second = f.second;third = f.third;fourth = f.fourth;}kilani(const kilani& p) = default;kilani(kilani&& p) = default;constexpr kilani& operator=(const kilani& other){first = other.first;second = other.second;third = other.third;fourth = other.fourth;return *this;}template<class E,class R,class Y,class X>constexpr kilani& operator=(const kilani<E,R,Y,X>& other){first = other.first;second = other.second;third = other.third;fourth = other.fourth;return *this;}constexpr kilani& operator=(kilani&& other) noexcept {first = other.first;second = other.second;third = other.third;fourth = other.fourth;return *this;}template<class E,class R,class Y,class X>constexpr kilani& operator=(kilani<E,R,Y,X>&& other){first = other.first;second = other.second;third = other.third;fourth = other.fourth;return *this;}friend void swap(kilani<F,S,T,L> &a, kilani<F,S,T,L> &b) {swap(a.first,b.first);swap(a.second,b.second);swap(a.third,b.third);swap(a.fourth,b.fourth);}bool operator==(const kilani<F,S,T,L>& o) const{return first == o.first && second == o.second && third == o.third && fourth == o.fourth;}bool operator!=(const kilani<F,S,T,L>& o) const{return first != o.first || second != o.second || third != o.third || fourth != o.fourth;}bool operator<(const kilani<F,S,T,L>& o) const{if(first == o.first){if(second == o.second){if(third == o.third)return fourth < o.fourth;return third < o.third;}return second < o.second;}return first < o.first;}bool operator<=(const kilani<F,S,T,L>& o) const{return (*this < o) || (*this == o);}bool operator>(const kilani<F,S,T,L>& o) const{return !(*this <= o);}bool operator>=(const kilani<F,S,T,L>& o) const{return !(*this < o);}};
template <typename F,typename S,typename T,typename L>kilani<F,S,T,L> make_kilani(F f,S s,T t,L l){kilani<F,S,T,L> ans;ans.first = f;ans.second = s;ans.third = t;ans.fourth = l;return ans;};
template <typename F,typename S,typename T,typename L>ostream& operator<<(ostream& os, const kilani<F,S,T,L>& v){os << "(" << v.first << "," << v.second << "," << v.third << "," << v.fourth << ")";return os;}

const long double PI = acosl(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
inline int rand(int l,int r){return uniform_int_distribution<int>(l, r)(rng);}
inline ll rand(ll l,ll r){return uniform_int_distribution<ll>(l, r)(rng64);}
//endfold

//global


int main(){
	//fold
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << setprecision(10);
	//endfold
	ll x,y;
	cin >> x >> y;
	if(x == y){
		cout << 0;
		return 0;
	}
	if(x == 0){
		if(y > 0){
			cout << y-x;
			return 0;
		}else{
			cout << -y+1;
			return 0;
		}
	}
	if(y == 0){
		if(x < 0){
			cout << y-x;
			return 0;
		}else{
			cout << 1+y-(-x);
			return 0;
		}
	}
	if(x > 0 && y > 0){
		if(x < y){
			cout << y-x;
			return 0;
		}else{
			cout << 1+y-(-x)-1;
			return 0;
		}
	}
	if(x < 0 && y > 0){
		if(-x > y){
			cout << (-x)-y+1;
			return 0;
		}else{
			cout << 1+y-(-x);
			return 0;
		}
	}
	if(y < 0 && x > 0){
		if(x > -y){
			cout << 1+(x-(-y));
			return 0;
		}else{
			cout << 1+((-y)-x);
			return 0;
		}
	}
	if(y < 0 && x < 0){
		if(x < y){
			cout << y-x;
			return 0;
		}else{
			cout << (-y)-(-x)+2;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256