#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,m,n) for(ll i=(m);i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back





int main(){

    ll a,b,c,d;
    cin>>a>>b>>c>>d;

    int ans=0;

    if (a==c and b==d){
        ans=0;
    }

    else if ((a+b)==(c+d) or (a-b)==(c-d) or (abs(a-c)+abs(b-d))<=3){
        ans=1;
        
    }


    else if ((a+b+c+d)%2==0){
        ans=2;
    }

    else {
        bool flag=false;

        for (int i=-2;i<=2;i++){
            for (int j=-2;j<=2;j++){
                int x=a+i;
                int y=b+j;
                if ((x+y)==(c+d) or (x-y)==(c-d) or (abs(x-c)+abs(y-d))<=3){
                    flag=true;
                }
            }
        }

        int x=a-3;
        int y=b;
        if ((x+y)==(c+d) or (x-y)==(c-d) or (abs(x-c)+abs(y-d))<=3){
            flag=true;
        }
        x=a+3;
        if ((x+y)==(c+d) or (x-y)==(c-d) or (abs(x-c)+abs(y-d))<=3){
            flag=true;
        }
        x=a;
        y=b-3;
        if ((x+y)==(c+d) or (x-y)==(c-d) or (abs(x-c)+abs(y-d))<=3){
            flag=true;
        }
        y=b+3;
        if ((x+y)==(c+d) or (x-y)==(c-d) or (abs(x-c)+abs(y-d))<=3){
            flag=true;
        }

        if (flag){
            ans=2;
        }
        else {
            ans=3;
        }




    }

    cout<<ans<<endl;







}
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(void){
    int r1, c1, r2, c2;
    cin >> r1 >> c1;
    cin >> r2 >> c2;
    if((r1==r2)&&(c1==c2)){
        cout << 0 << endl;
    }else if((r1+c1 == r2+c2)||(r1-c1 == r2-c2)){
        cout << 1 << endl;
    }else if(abs(r1-r2)+abs(c1-c2)<=3){
        cout << 1 << endl;
    }else if((r1+c1)%2 == (r2+c2)%2){
        cout << 2 << endl;
    }else if(min(abs(r1+c1-r2-c2), abs(r1-c1-r2+c2))<=3){
        cout << 2 << endl;
    }else if(abs(r1-r2)+abs(c1-c2)<=6){
        cout << 2 << endl;
    }else{
        cout << 3 << endl;
    }
    return 0;
}