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

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    a = c - a, b = d - b;
    if (a == 0 && b == 0) cout << 0 << endl;
    else if (a + b == 0 || a - b == 0 || abs(a) + abs(b) <= 3) cout << 1 << endl;
    else if ((a + b) % 2 == 0 || abs(abs(a) - abs(b)) <= 6 || abs(a) + abs(b) <= 6) cout << 2 << endl;
    else cout << 3 << endl;
    return 0;
}
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
#define GETVEC(v) for(auto& m : v) cin >> m;
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
	int ans = -1;
	if (r1 == r2 && c1 == c2)
	{
		ans = 0;
	}
	else if (abs(r1 - r2) + abs(c1 - c2) <= 3 || abs(r1 - r2) == abs(c1 - c2))
	{
		ans = 1;
	}
	else if ((r1 + c1) % 2 == (r2 + c2) % 2)
	{
		ans = 2;
	}
	else
	{
		ans = 3;
		for (int r = r1 - 2; r <= r1 + 2; ++r)
		{
			for (int c = c1 - 2; c <= c1 + 2; ++c)
			{
				if (abs(r - r2) + abs(c - c2) <= 3
					|| abs(r - r2) == abs(c - c2))
				{
					ans = 2;
				}
			}
		}
	}

	cout << ans << endl;
}
