#include <stdio.h>
#include <iostream>
#include <vector>
// #include <bits/stdc++.h>
#include <queue>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i,k,n) for(ll i=k; i<(ll)(n); i++)
#define Q 1000000007

ll max(vector<ll> a) {
    return *max_element(a.begin(), a.end());
}

ll max_index(vector<ll> a) {
    vector<ll>::iterator max_it = max_element(a.begin(), a.end());
    return distance(a.begin(), max_it);
}


int main(){
    ll r1,r2,c1,c2;
    cin >> r1 >> c1;
    cin >> r2 >> c2;

    ll r = r1-r2, c = c1-c2;
    ll ans = 3;
    if(r==0 && c==0) ans = 0;
    else if(r==c || r+c==0 || abs(r)+abs(c)<=3) ans = 1;
    else if((r1+r2+c1+c2)%2==0 || abs(r)+abs(c)<=6 || abs(r+c)<=3 || abs(r-c)<=3) ans = 2;


    cout << ans << endl;

    return 0;
}
	/*It is better to taste failure 
	  than to regret*/
		
            #include <algorithm>
        #include <bitset>
        #include <cassert>
        #include <chrono>
        #include <cmath>
        #include <complex>
        #include <cstdio>
        #include <cstdlib>
        #include <cstring>
        #include <ctime>
        #include <deque>
        #include <functional>
        #include <iomanip>
        #include <iostream>
        #include <iterator>
        #include <limits>
        #include <climits>
        #include <list>
        #include <map>
        #include <numeric>
        #include <queue>
        #include <random>
        #include <ratio>
        #include <set>
        #include <sstream>
        #include <stack>
        #include <string>
        #include <unordered_map>
        #include <unordered_set>
        #include <utility>
        #include <vector>
        using namespace std;
         
        typedef long long ll;
        typedef long double LD;
        #define int ll
        #define double LD
        #define pb push_back
        #define mp make_pair
        #define REP(i,n) for (int i = 0; i < n; i++)
        #define loop(i,n) for (int i = 0; i < n; i++)
        #define FOR(i,a,b) for (int i = a; i < b; i++)
        #define REPD(i,n) for (int i = n-1; i >= 0; i--)
        #define FORD(i,a,b) for (int i = a; i >= b; i--)
        #define remax(a,b) a = max(a,b)
        #define remin(a,b) a = min(a,b)
        #define mem(a, b) memset(a, b, sizeof a)
        #define append push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define print(x) cout << (x) << endl
        #define PRECISION(x) cout << fixed << setprecision(x)
        #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
        #define Test(){int t;cin >> t;for(int i=1;i<=t;i++){cout << "Case #" << i << ": ";solve();}}
        #define test(){int t; cin>>t; for(int i=1;i<=t;i++){solve();}}
        #define vi vector<int>
        #define vii vector<pair<int,int> > 
        #define vci vector<pair<char,int> >
        #define vic vector<pair<int,char> > 
        #define N 200005
        #define pb push_back
        const double PI=acos(-1);
        const int MOD = 1000000007;
        const int FMOD = 998244353;
        
        
        int maxSumsubarray(int arr[], int n, int maxSum){
   int sum = arr[0], overallMax = 0, start = 0;
   for (int i = 1; i < n; i++) {
      if (sum <= maxSum)
      overallMax = max(overallMax, sum);
      while (sum + arr[i] > maxSum && start < i) {
         sum -= arr[start];
         start++;
      }
      sum += arr[i];
   }
   if (sum <= maxSum)
      overallMax = max(overallMax, sum);
   return overallMax;
}
        void solve()
        {
        	
        	int a,b,c,d;
	cin >>a>>b>>c>>d;
	if(a==c && b==d){
		cout << "0\n";
		return;
	}
	if(a-b == c-d || a+b == c+d){
		cout << "1\n";
		return;
	}
	else if(abs(a-c) + abs(b-d) <= 3){
		cout << "1\n";
		return;
	}
	if((a+b)%2 == (c+d)%2){
		cout << "2\n";
	}
	else{
		
		for(int i=-3;i<=3;i++){
			for(int j=-3;j<=3;j++){
				int x = c + i;
				int y = d + j;
				if(abs(c-x) + abs(d-y) <= 3){
					if(x-y == a-b || x+y == a+b){
						cout << "2\n";
						return;
					}
				}
			}
		}
		cout << "3\n";
	}
    
		}
        signed main()
        {
        //	test();
        solve();
		}