#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < ll > vl;
typedef vector < vl > vvl;
typedef pair < ll, ll > pll;
typedef vector < pair < ll, ll > > vpll;
#define kill freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
#define fi first
#define se second
#define MOD 998244353
#define Boost() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD1 1000000007
ll power(ll a, ll b){ll res=1;while(b>0){if(b&1){res=(res*a)%MOD;}a=(a*a)%MOD;b>>=1LL;}return res;}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
#define oo LLONG_MAX
const ll dx[]={-1,0,1, 0,-1,1, 1,-1};
const ll dy[]={ 0,1,0,-1, 1,1,-1,-1};

void solve(){
    ll r1,c1,r2,c2;
    cin>>r1>>c1>>r2>>c2;
    int ans = 3;
    if (r1 == r2 && c1 == c2) ans = min(ans, 0);
    if (r1 + c1 == r2 + c2) ans = min(ans, 1);
    if (r1 - c1 == r2 - c2) ans = min(ans, 1);
    if (abs(r1 - r2) + abs(c1 - c2) <= 3) ans = min(ans, 1);
    if ((r1 % 2 == r2 % 2) && (c1 % 2 == c2 % 2)) ans = min(ans, 2);
    if ((r1 % 2 != r2 % 2) && (c1 % 2 != c2 % 2)) ans = min(ans, 2);
    if (abs((r1 + c1) - (r2 + c2)) <= 4) ans = min(ans, 2);
    if (abs((r1 - c1) - (r2 - c2)) <= 4) ans = min(ans, 2);
    cout<<ans;
}
int main(){
    Boost();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	c-=a;
	d-=b;
	d=abs(d);
	c=abs(c);
	if ( c> d)
		swap( c,d);
	if ( abs( d)==abs(c)){
		if ( d==0)
			cout<<0<<"\n";
		else
			cout<<1<<'\n';
	}
	else
	if ( abs( d)+abs( c)<=3){
		cout<<1<<'\n';
	}
	else
	if ( d-c<=3||d+c<=6)
	{
		cout<<2<<'\n';
	}
	else
	if ( (d+c)%2==0)
		cout<<2<<'\n';
	else
		cout<<3<<'\n';
}