#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int,int> pii;
#define lll int64_t //need to use g++ -std=c++11 or more ...
#define pb push_back
#define For(i,n) for(int i=0;i<n;i++)
#define fi first
#define se second
#define all(x) x.begin(), x.end()
template<typename T>
void enter(vector<T>& a, int n){
    For(i,n) cin >> a[i];
}
template<typename T>
void enter(T a[], int n){
    For(i,n) cin >> a[i];
}
template<typename T>
void enter(vector<T>& a){
    For(i,a.size()) cin >> a[i];
}
template<typename T>
void print(vector<T>& a){
    For(i,a.size()) cout<<a[i]<<' ';
    cout << endl;
}
template<typename T>
void print(T a[], int n){
    For(i,n) cout<<a[i]<<' ';
    cout << endl;
}
template<typename T>
void printRev(vector<T>& a){
    For(i,a.size()) cout<<a[a.size() - 1 - i]<<' ';
    cout << endl;
}
bool check(int a, int b, int c, int d){
    return (a+b == c+d) || (a-b==c-d) || (abs(a-c)+abs(b-d)<=3);
}
void solve(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    c -= a; d-=b;
    a = 0; b = 0;
    c = abs(c); d = abs(d);
    if(a == c && b == d){
        cout << 0;
        return;
    }
    else if(check(a,b,c,d)){
        cout << 1;
        return;
    }
    else if(c + d <= 6 || c + d <= 3 || abs(c-d) <=3 || (c*1ll+d*1ll)%2 == 0){
        cout << 2;
        return;
    }
    cout << 3;
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t=1;
    //cin >> t;
    while(t--) solve();

    return 0;
}
#include <bits/stdc++.h>

using namespace std;

void fastio() {
	cin.tie(nullptr);
	cin.sync_with_stdio(false);
}

using LL = long long;
using LD = long double;

const LL MOD = 1e9+7;
const LL INF = 1e18;
const LL N = 3e5+1;
const LD eps = 1e-9;

#define S second
#define F first
#define vt vector

int main () {
	fastio();

	LL r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;

	LL ans = INF;
	if (r1 == r2 && c1 == c2) {
		ans = 0;
	}
	else if (abs(r1-r2)+ abs(c1-c2) <= 3) {
		ans = 1;
	}
	else {
		for (LL i = -3; i <= 3; ++i) {
			for (LL j = -3; j <= 3; ++j) {
				if (abs(i) + abs(j) <= 3) {
					LL a1 = 1;
					if (i == 0 && j == 0) {
						a1 = 0; // same point
					}

					if ((r1+i+c1+j) == (r2+c2)) {
						a1++;
					}
					else if ((r1+i-c1-j) == (r2-c2)) {
						a1++;
					}
					else {
						if (abs((r1+i+c1+j)%2) != abs((r2+c2)%2)) {
							a1 += 3;
						}
						else {
							a1 += 2;
						}
					}
					ans = min(ans, a1);
				}
			}
		}
	}

	if (abs(r1-r2)+abs(c1-c2) <= 6) {
		ans = min(ans, 2LL);
	}

	cout << ans << "\n";

	//cout << (-1)%2 << "?";
}