#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
typedef pair<int, pi> pii;

int x2,y2;

int test(int x1,int y1, int grad1, int grad2) {
	if (x1 - y1 == grad1 or x1+y1 == grad2) {
		return 1;
	} else {
		if (((x1 - y1) - grad1) % 2 == 0) {
			return 2;
		} else if ((grad2 - (x1 + y1)) % 2 == 0) {
			return 2;
		}
	}
	return INT_MAX/2;
}

int32_t main() {
	FAST
	int x1,y1;
	cin >> x1 >> y1 >> x2 >> y2;
	if (x1 == x2 and y1 == y2) {
		cout << 0;
		return 0;
	}
	
	int grad1 = x2 - y2;
	int grad2 = x2 + y2;
	
	int ans = test(x1,y1,grad1,grad2);
	
	for (int x = x2-3; x <= x2+3; x++) {
		for (int y = y2-3; y <= y2 +3;y++) {
			if (abs(x - x2) + abs(y - y2) <= 3) {
				ans = min(ans, test(x1,y1,x - y, x +y) + 1);
			}
		} 
	}
	
	for (int x = x1-3; x <= x1+3; x++) {
		for (int y = y1-3; y <= y1 +3;y++) {		
			if (abs(x1 - x) + abs(y1 - y) <= 3) {
				if (x == x2 and y == y2) {
					ans = min(ans, 1ll);
				}
				
				ans = min(ans, test(x,y,grad1, grad2) + 1);
			}
		} 
	}
	
	cout << ans;
}





#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1000000000000000000

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int tt=1;
	//cin >> tt;
	while(tt--)
	{
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		if(a==c&&b==d)
		{
			cout << 0 << endl;
		}
		else if(a+b==c+d||a-b==c-d||abs(a-c)+abs(b-d)<=3)
		{
			cout << 1 << endl;
		}
		else if(abs((a+b)-(c+d))<=3||abs((a-b)-(c-d))<=3)
		{
			cout << 2 << endl;
		}
		else if((a+b)%2==(c+d)%2)
		{
			cout << 2 << endl;
		}
		else
		{
			cout << 3 << endl;
		}
	}
	return 0;
}