#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	ll r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	cout << [&]() -> ll {
		if (r1 == r2 && c1 == c2) return 0;
		if (r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2) return 1;
		if (abs(r2 - r1) + abs(c2 - c1) <= 3) return 1;
		if ((r2 + c2) % 2 == (r1 + c1) % 2) return 2;
		
		FOR(dx, -2, 3) FOR(dy, -2, 3) {
			ll x = r2 + dx, y = c2 + dy;
			if (r1 + c1 == x + y || r1 - c1 == x - y) return 2;
			if (abs(x - r1) + abs(y - c1) <= 3) return 2;
		}
		return 3;
	}() << endl;
	return 0;
}
#include <bits/stdc++.h>

#include <iostream>
using namespace std;

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

    if (r1 == r2 && c1 == c2) {
        // その場にいる
        cout << 0 << endl;
        return 0;
    } else if (abs(r1 - r2) + abs(c1 - c2) <= 3) {
        // ３マス以内にいる
        cout << 1 << endl;
        return 0;
    } else if (r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2) {
        // 対角線にいる
        cout << 1 << endl;
        return 0;
    } else if ((r2 - r1 + c2 - c1) % 2 == 0) {
        // 対角線にはいないが、市松模様で同じ色のところにいる
        cout << 2 << endl;
        return 0;
    } else if (abs(r1 - r2) + abs(c1 - c2) <= 6) {
        cout << 2 << endl;
        return 0;
    } else {
        // ゴールから対角に降りてきて、r2 == r1の位置に持ってくる
        // その位置に１手で行けるなら、答えは２手
        // ただし、4マス離れていても大丈夫
        long long diff = r2 - r1;
        if (-4 <= (c2 - diff - c1) && (c2 - diff - c1) <= 4) {
            cout << 2 << endl;
        } else if (-4 <= (c2 + diff - c1) && (c2 + diff - c1) <= 4) {
            cout << 2 << endl;
        } else {
            cout << 3 << endl;
        }

        return 0;
    }

    return 0;
}