#include <bits/stdc++.h>

using namespace std;

int main()
{
	int r1, c1, r2, c2;

	cin >> r1 >> c1 >> r2 >> c2;

	int r = r2 - r1, c = c2 - c1;

	if (r == 0 && c == 0) {
		cout << 0 << endl;
	} else if (r == c || r == -c || abs(r) + abs(c) <= 3) {
		cout << 1 << endl;
	} else if ((r ^ c ^ 1) & 1) {
		cout << 2 << endl;
	} else if ( abs(r + c) <= 3 || abs(r - c) <= 3 || abs(r) + abs(c) <= 6) {
		cout << 2 << endl;
	} else {
		cout << 3 << endl;
	}


	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define int ll
#define mp make_pair
#define pii pair<int,int>
#define pb push_back
#define r1 rt<<1
#define r2 rt<<1|1
#define fi first
#define se second
#define db double
#define ld long db
#define ri register int
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define rep2(i,a,b,c) for(ri i=(a);i<=(b);i+=(c))
#define REP(i,a,b) for(ri i=(a);i>=(b);--i)
#define REP2(i,a,b,c) for(ri i=(a);i>=(b);i-=(c))
using namespace std;

inline int read(){
	ri x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^'0'),c=getchar();
	return x*f;
}
bool chk(ri a,ri b,ri c,ri d){
	if(a+b==c+d)return 1;
	if(a-b==c-d)return 1;
	if(abs(a-c)+abs(b-d)<=3)return 1;
	return 0;
}
signed main()
{
	ri a1=read(),b1=read(),a2=read(),b2=read();
	if(a1==a2&&b1==b2){
		puts("0");
		return 0;
	}
	if(chk(a1,b1,a2,b2)){
		puts("1");
		return 0;
	}
	rep(x,a1-3,a1+3)rep(y,b1-3,b1+3){
		if(abs(a1-x)+abs(b1-y)<=3){
			if(chk(x,y,a2,b2)){
				puts("2");
				return 0;
			}
		}
	}
	rep(x,a2-3,a2+3)rep(y,b2-3,b2+3){
		if(abs(a2-x)+abs(b2-y)<=3){
			if(chk(x,y,a1,b1)){
				puts("2");
				return 0;
			}
		}
	}
	if((a1+a2+b1+b2)%2==0){
		puts("2");
		return 0;
	}
	puts("3");
	return 0; 
}
/*
1353 1025 3426 458 
9 2 46 17 
10 4 3 17 
6 8 9 1 
*/