#include<cstdio>

int abs(int u){
    return u>0?u:-u;
}

int getDis(int a,int b,int c,int d){
    if(a==c && b==d) return 0;
    else if((a+b)==(c+d) || (a-b)==(c-d) || abs(a-c)+abs(b-d)<=3) return 1;
    else{
        int x = (a+b)%2, y = (c+d)%2, z = (a-b)%2, w = (c-d)%2;
        if(z<0) z += 2;
        if(w<0) w += 2;
        if(x==y || z==w) return 2;
        return 3;
    }
}

int main(){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a==c && b==d) printf("0\n");
    else if((a+b)==(c+d) || (a-b)==(c-d) || abs(a-c)+abs(b-d)<=3) printf("1\n");
    else{
        int ans = getDis(a,b,c,d);
        for(int i = -2; i <= 2; i++){
            for(int  j = -2; j <= 2; j++){
                for(int k = -2; k <= 2; k++){
                    for(int l = -2; l <= 2; l++){
                        int cur = getDis(a+i,b+j,c+k,d+l);
                        if(i!=0 || j!=0) cur++;
                        if(k!=0 || l!=0) cur++;
                        if(ans>cur) ans = cur;
                    }
                }
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

#include<iostream>
#include<array>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}

int r1,c1,r2,c2;

bool ok(int x,int y){
    if(abs(x)+abs(y)<=3) return true;
    if(x+y==0) return true;
    if(x-y==0) return true;
    return false;
}

void solve(){
    cin >> r1 >> c1 >> r2 >> c2;
    if(r1==r2 && c1==c2){
        cout << 0 << endl;
        return;
    }
    if(r1+c1==r2+c2){
        cout << 1 << endl;
        return;
    }
    if(r1-c1==r2-c2){
        cout << 1 << endl;
        return;
    }
    if(abs(r1-r2)+abs(c1-c2)<=3){
        cout << 1 << endl;
        return;
    }
    int x=abs(r1-r2),y=abs(c1-c2);
    if((x+y)%2==0){
        cout << 2 << endl;
        return;
    }
    Rep(i,-2,3){
        Rep(j,-2,3){
            //cout << x+i << " " << y+j << endl;
            if(ok(x+i,y+j)){
                cout << 2 << endl;
                return;
            }
        }
    }
    cout << 3 << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}