#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int64_t i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int64_t i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const ll md = 1000000007;

bool canReach(ll a, ll b, ll c, ll d) {
    if (a + b == c + d || a - b == c - d || abs(a - c) + abs(b - d) <= 3) {
    	return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a == c && b == d) {
    	cout << 0 << endl;
    	return 0;
    }
    if (canReach(a, b, c, d)) {
    	cout << "1\n";
    	return 0;
    }
    if ((c + d - a + b) % 2 == 0 && (a - b + c + d) % 2 == 0) {
    	cout << 2 << endl;
    	return 0;
    }
    if ((a + b +c - d) % 2 == 0 && (a + b - c + d) % 2 == 0) {
    	cout << 2 << endl;
    	return 0;
    }
    for (ll x = c - 6; x <= c + 6; x++) {
    	for (ll y = d - 6; y <= d + 6; y++) {
    		if (abs(x - c) + abs(y - d) > 3) continue;
    		if (canReach(a, b, x, y)) {
    			cout << "2\n";
    			return 0;
    		}
    	}
    }
    cout << 3 << endl;

}

#include <algorithm>
#include <cstdio>
#include <cmath>
using std::min;

long long c1, r1, c2, r2;

int main(void) {
	scanf("%lld%lld%lld%lld", & r1, & c1, & r2, & c2);
	if (r1 == r2 && c1 == c2) {
		puts("0");
		return 0;
	}
	if (llabs(r2 - r1) + llabs(c2 - c1) <= 3 || r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2) {
		puts("1");
		return 0;
	}
	if ((llabs(r2 - r1) & 1) == (llabs(c2 - c1) & 1)) {
		puts("2");
		return 0;
	}
	else {
		long long deltay = llabs(c2 - c1), deltax = llabs(r2 - r1);
		if (min(llabs(r2 - deltay - r1), llabs(r2 + deltay - r1)) <= 3)
			puts("2");
		else if (min(llabs(c2 - deltax - c1), llabs(c2 + deltax - c1)) <= 3)
			puts("2");
		else
			puts("3");
	}
	return 0;
}