#include<bits/stdc++.h>
using namespace std;
#define int long long
int a,b,c,d;
bool check(int a,int b,int c,int d)
{
    if(a + b == c + d || a - b == c - d || abs(a-c) + abs(b-d) <= 3) return true;
    return false;
}
signed main()
{
    cin >> a >> b >> c >> d;
    if(a == c && b == d) {puts("0"); return 0;}
    else if(a + b == c + d || a - b == c - d || abs(a-c) + abs(b-d) <= 3) {puts("1"); return 0;}
    else
    {
        for(int i = a - 3; i <= a + 3; ++ i)
        {
            for(int j = b - 3; j <= b + 3; ++ j)
            {
                if(abs(i - a) + abs(j - b) <= 3)
                {
                    if(check(i,j,c,d)) {puts("2"); return 0;}
                }
            }
        }

    }

    double x1 = (d + c + a - b) / 2.0 , x2 = (a + b + c -d) / 2.0;
//    cout << x1 << ' ' << x2 << endl;
    if(x1 == (int)x1 || x2 == (int)x2) puts("2");
    else puts("3");
}

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;


int main(){
long long r1,r2,c1,c2, a, b;
cin >> r1 >> c1;
cin >> r2 >> c2;
int x;
a=abs(r2-r1); b=abs(c2-c1);
if(a==0&&b==0){x=0;cout<< x <<endl;return 0;}
if((a+b)<4||a-b==0){x=1;cout<< x <<endl;return 0;}
if((a+b)%2==0||abs(a-b)<4){x=2;cout<< x <<endl;return 0;}
x=3; cout<< x <<endl;
return 0;
}

