#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define MOD 1000000007

int main() {
    ll r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    int ans = 0;
    if (r1 == r2 && c1 == c2) {
        cout << ans << endl;
        return 0;
    }
    int limit = 10;
    for (int dx = -3; dx <= 3; dx++) {
        for (int dy = -3; dy <= 3; dy++) {
            if (abs(dx) + abs(dy) > 3) {
                continue;
            }
            ll nr = r1 + dx;
            ll nc = c1 + dy;
            if (nr + nc == r2 + c2 || nr - nc == r2 - c2 || abs(nr - r2) + abs(nc - c2) <= 3) {
                limit = 2;
            }
        }
    }
    while (true) {
        ans++;
        if (r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2 || abs(r1 - r2) + abs(c1 - c2) <= 3) {
            break;
        }
        if (ans == 1) {
            ll d = r2 - r1;
            r1 += d;
            c1 += d;
            d = (c2 - c1) / 2;
            r1 += d;
            c1 += d;
            continue;
        }
        if (ans == 2) {
            ans++;
            break;
        }
    }
    cout << min(ans, limit) << endl;
    return 0;
}

#include<bits/stdc++.h>
#define int long long
using namespace std;
int x,y,a,b;
signed main()
{
	scanf("%lld%lld%lld%lld",&x,&y,&a,&b);
	if(x<a)
		swap(x,a),swap(y,b);
	if(x==a&&y==b)
	{
		puts("0");
		return 0;
	}
	if(x+y==a+b||x-y==a-b||abs(x-a)+abs(y-b)<=3)
	{
		puts("1");
		return 0;
	}
	if((a+b)%2==(x+y)%2||(abs(b+(a-x)-y))<=3||(abs(b-(a-x)-y))<=3)
	{
		puts("2");
		return 0;
	}
	puts("3");
	return 0;
}
