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

template<typename T, typename U>
using vp = vector<pair<T,U>>;
template<typename T>
using pque = priority_queue<T>;
template<typename T>
using lpque = priority_queue<T,vector<T>,greater<T>>;

using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using pli = pair<ll,int>;
using vint = vector<int>;
using vll = vector<ll>;
using qint = queue<int>;
using pqint = pque<int>;
using qll = queue<ll>;
using pqll = pque<ll>;

constexpr double PI = 3.141592653589793;
constexpr int INTINF = (1<<30)-1;
constexpr ll LLINF = (1LL<<62)-1;
constexpr int MPRIME = 1000000007;
constexpr int MPRIME9 = 998244353;
constexpr ll MMPRIME = (1LL<<61)-1;
constexpr char newl = '\n';

#define len length()
#define pushb push_back
#define fi first
#define se second

#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

template<typename T>
struct matrix{
private:
	vector<vector<T>> mat;

public:
	matrix() : matrix(0,0) {}
	matrix(int h, int w) { resize(h,w); }
	matrix(int h, int w, T init) { resize(h,w,init); }

	void resize(int h, int w) {
		mat=vector<vector<T>>(h,vector<T>(w));
	}
	void resize(int h, int w, T init) {
		mat=vector<vector<T>>(h,vector<T>(w,init));
	};

	void in() {
		for(int i=0; i<mat.size(); i++) for(int j=0; j<mat[i].size(); j++) {
			cin>>mat[i][j];
		}
	}

	void out() {
		for(int i=0; i<mat.size(); i++) {
			int wm=mat[i].size();
			for(int j=0; j<wm; j++) {
				cout<<mat[i][j]<<(wm==j+1 ? '\n' : ' ');
			}
		}
		cout<<flush;
	}

	inline vector<T> &operator[](int idx) {
		assert(0<=idx && idx<mat.size());
		return mat[idx];
	}
};

template<class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

template<class T>
inline void out(T a) {
	cout<<a<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

long long binpow(long long a, long long ex, long long p=MMPRIME) {
	long long res = 1;
	while(ex > 0) {
		if(ex & 1) (res*=a) %= p;
		ex>>=1;
		(a*=a) %= p;
	}
	return res;
}


ll r1,c1,r2,c2;

void input() {
	cin>>r1>>c1>>r2>>c2;
}

void solve() {
	if(r1==r2 && c1==c2) {
		cout<<0<<newl;
		return;
	}
	if(r1+c1==r2+c2 || r1-c1==r2-c2 || abs(r1-r2)+abs(c1-c2)<=3) {
		cout<<1<<newl;
		return;
	}
	if((r1+c1)%2==(r2+c2)%2 || abs(r1-r2)+abs(c1-c2)<=6 || abs(r1+c1-r2-c2)<=3 || abs(r1-c1-r2+c2)<=3) {
		cout<<2<<newl;
		return;
	}
	cout<<3<<newl;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t--) {
		input();
		solve();
	}
}

#include <bits/stdc++.h>
//#define int ll
using namespace std;
typedef long long ll;
const int maxn=1e6+5;
const int mod=998244353;

void solve() {
    int a,b,c,d;
    int sum=0;
    cin>>a>>b>>c>>d;
    int x=abs(c-a);
    int y=abs(d-b);
    if(x==0&&y==0) {
        cout<<"0\n";
        return;
    }
    if(x==y||x+y<=3) {
        cout<<"1\n";
        return;
    }
    if(abs(x+y)%2==0||x+y<=6||abs(x-y)<=3) {
        cout<<"2\n";
        return;
    }
    cout<<"3\n";
}

signed main() {
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//    freopen("1.in","r",stdin);
    int _ = 1;
    //cin >> _;
    //init();
    while (_--) {
        solve();
    }
    return 0;
}