#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<list>
#define ll long long
#define str string
#define ld long double
#define vec vector
#define vll vec<ll>
#define vvll vec<vll>
#define vbo vec<bool>
#define vvbo vec<vbo>
#define vin(a) rep(i,0,a.size())cin>>a[i];
#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,b,a) for(ll i=(b);i>=(a);i--)
#define repset(itr,a) for(auto itr=a.begin();itr!=a.end();itr++)
#define repnck(bit,n,k) for(ll bit=(1ll<<(k))-1;bit<(1ll<<(n));bit=(bit==0?(1ll<<(n)):nec(bit)))
#define bi1(bit,i) ((bit)&1ll<<(i)?true:false)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define kai "\n"
#define prque priority_queue
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mie min_element
#define mae max_element
#define tos to_string
#define sep setprecision
#define lob lower_bound
#define upb upper_bound
#define bis binary_search
#define nep next_permutation
#define MOD 1000000007ll
#define MAX 2147483647ll
#define MIN 0.0000000001l
#define equal(a,b) (abs((a)-(b))<MIN)
using namespace std;
void solve();
struct ll2{ll x,y;bool operator<(const ll2 &l)const{return x!=l.x?x<l.x:y<l.y;};};
struct ll3{ll x,y,z;bool operator<(const ll3 &l)const{if(x!=l.x)return x<l.x;if(y!=l.y)return y<l.y;return z<l.z;};};

class ufset{
public:
	ufset(ll n) {rank.resize(n,0);rep(i,0,n)p.pub(i);}
	bool same(ll i,ll j){return find(i)==find(j);}
	void unite(ll i,ll j){link(find(i),find(j));}
	ll find(ll i){if(i!=p[i])p[i]=find(p[i]);return p[i];}
private:
  vll p,rank;
	void link(ll i,ll j){if(rank[i]>rank[j])p[j]=i;else{p[i]=j;if(rank[i]==rank[j])rank[j]++;}}
};

class nck{
public:
	nck(ll maxn,ll mod=MOD){
		NUM=maxn+1;p=mod;
		fac.resize(NUM);finv.resize(NUM);inv.resize(NUM);
		fac[0]=fac[1]=finv[0]=finv[1]=inv[1]=1;
		rep(i,2,NUM){fac[i]=fac[i-1]*i%p;inv[i]=p-inv[p%i]*(p/i)%p;finv[i]=finv[i-1]*inv[i]%p;}
	}
	ll c(ll n,ll k){return fac[n]*(finv[k]*finv[n-k]%p)%p;}
private:
  ll NUM,p;
	vll fac,finv,inv;
};

ll gcd(vector<ll> a){rep(i,1,a.size()){ll k=a[i-1]%a[i];while(k!=0){a[i-1]=a[i];a[i]=k;k=a[i-1]%a[i];}}return a.back();}
ll lcm(vector<ll> a){ll n;rep(i,1,a.size()){n=a[i-1]*a[i];ll k=a[i-1]%a[i];while(k!=0){a[i-1]=a[i];a[i]=k;k=a[i-1]%a[i];}n/=a[i];a[i]=n;}return n;}
ll pow2(ll a,ll b,ll p=MOD){if(b==-1)return pow2(a,p-2,p);ll res=1;if(b>0){res=pow2(a,b/2,p);if(b%2==0)res=res*res%p;else res=res*res%p*a%p;}return res;}
ll nec(ll bit){ll x=bit&-bit,y=bit+x;return (((bit&~y)/x)>>1)|y;}
ll bisz(ll bit){ll size=0;while(bit>0){bit/=2;size++;}return size;}
ll ransu(){static unsigned int TX=123456789, TY=362436069, TZ=521288629, TW=88675123;unsigned int tt=(TX^(TX<<11));TX=TY;TY=TZ;TZ=TW;return (TW=(TW^(TW>>19))^(tt^(tt>>8)));}
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed;
	solve();
}
void solve(){
	ll a,b,c,d;cin>>a>>b>>c>>d;
	if(a==c&&b==d){cout<<0<<kai;return;}
		if(a+b==c+d||a-b==c-d||abs(a-c)+abs(b-d)<=3){
			cout<<1<<kai;return;
		}else if((c+d-a-b)%2==0){
			cout<<2<<kai;return;
		}
	rep(i,-3,4)rep(j,-3,4){
		if(abs(i)+abs(j)<=3){
			if(a+b==c+d+i+j||a-b==c+i-d-j||abs(a-c-i)+abs(b-d-j)<=3){
				cout<<2<<kai;return;
			}
		}
	}
	cout<<3<<kai;
}
#include<bits/stdc++.h>
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using namespace std;

int ri(){
  int n;cin>>n;
  return n;
}

int main(){
  ll r1=ri(),c1=ri(),r2=ri(),c2=ri();
  int ans;
  if(r1==r2 && c1==c2) ans=0;
  else if(r1+c1==r2+c2 || r1-c1 == r2-c2 || abs(r1-r2)+abs(c1-c2)<=3){
    ans=1;
  }
  else if(abs(r1-r2)+abs(c1-c2)<=6 || (r1+c1)%2==(r2+c2)%2 || abs(c1-c2+r1-r2)<=3
          || abs(c1-c2-r1+r2)<=3){
    ans=2;
  }
  else ans=3;
  cout<<ans;
}
  