#include <bits/stdc++.h> 
using namespace std; 
int main() { 
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin);
#endif
	int r1, c1, r2, c2; 
	cin >> r1 >> c1 >> r2 >> c2; 
	int ans = 3;
	if (abs(r1 - r2) + abs(c1 - c2) <= 6 || ((r1 + c1) & 1) == ((r2 + c2) & 1)) ans = 2; 
	for (int tx, ty, i = 3; i >= 0; i--)
		for (int j = 3 - i; j >= 0; j--)
			for (int x = -1; x <= 1; x += 2)
				for (int y = -1; y <= 1; y += 2) {
					tx = r2 + i * x, ty = c2 + j * y;
					if (abs(r1 - tx) + abs(c1 - ty) <= 3 || r1 + c1 == tx + ty || r1 - c1 == tx - ty) ans = 2;
				}
	if (abs(r1 - r2) + abs(c1 - c2) <= 3 ||
		r1 + c1 == r2 + c2 ||
		r1 - c1 == r2 - c2) ans = 1;
	if (r1 == r2 && c1 == c2) ans = 0;
	printf("%d\n", ans);
	return 0; 
}
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define ti3 tuple<int,int,int>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int main(){
    ll r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    ll rd = abs(r2 - r1), cd = abs(c2 - c1);
    if(rd == 0 && cd == 0){
        cout << 0 << endl;
    }else if(abs(rd) + abs(cd) <= 3 || abs(rd) == abs(cd)){
        cout << 1 << endl;
    }else if(abs(rd) % 2 == abs(cd) % 2 || abs(rd - cd) <= 3 || rd + cd <= 6){
        cout << 2 << endl;
    }else{
        cout << 3 << endl;
    }
    return 0;
}