#include<iostream>
#include<iomanip>
#include<bitset>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<queue>
#include<map>
#include<set>
using namespace std;
using ll=long long;

int main(){
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    if(r1 == r2 && c1 == c2){
        cout << 0 << endl;
        return 0;
    }
    if(r1 - c1 == r2 -c2 || r1 + c1 == r2 + c2 || abs(r1 - r2) + abs(c1 - c2) <= 3){
        cout << 1 << endl;
        return 0;
    }
    if((abs(r1 - r2) + abs(c1 - c2)) % 2 == 0){
        cout << 2 << endl;
        return 0;
    }
    for(int i = -2; i <= 2; i++){
        for(int j = -2; j <= 2; j++){
            int r, c;
            r = r1 + i;
            c = c1 + j;
            if(r - c == r2 - c2 || r + c == r2 + c2 || abs(r - r2) + abs(c - c2) <= 3){
                cout << 2 << endl;
                return 0;
            }
        }
    }
    vector<int> x = {3, 0, -3, 0}, y = {0, 3, 0, -3};
    for(int i = 0; i < 4; i++){
        int r, c;
        r = r1 + x[i];
        c = c1 + y[i];
        if(r - c == r2 - c2 || r + c == r2 + c2 || abs(r - r2) + abs(c - c2) <= 3){
            cout << 2 << endl;
            return 0;
        }
    }
    cout << 3 << endl;
    return 0;
}
#include <bits/stdc++.h>
#define fi first
#define se second
#define o2(x) (x) * (x)
#define mk make_pair
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset((a), (b), sizeof((a)))
#define rep(i, s, t) for(register int i = (s), LIM=(t); i < LIM; ++i)
#define per(i, s, t) for(register int i = (s), LIM=(t); i >= LIM; --i)
#define GKD std::ios::sync_with_stdio(false);cin.tie(0)
#define my_unique(x) sort(all(x)), x.erase(unique(all(x)), x.end())
using namespace std;
typedef long long LL;
typedef long long int64;
typedef unsigned long long uint64;
typedef pair<int, int> pii;
// mt19937 rng(time(NULL));//std::clock()
// mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
// shuffle(arr, arr + n, rng64);
inline int64 read() {
    int64 x = 0;int las = 0;char ch = getchar();
    while (ch < '0' || ch > '9') las |= (ch == '-'), ch = getchar();
    while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch =
    getchar(); return x = las ? -x : x;
}
inline void write(int64 x, bool las = true) {
    if (x == 0) {putchar('0'); if(las)putchar('\n');else putchar(' ');return;}
    if (x < 0) {putchar('-');x = -x;}
    static char s[23];
    int l = 0;
    while (x != 0)s[l++] = x % 10 + 48, x /= 10;
    while (l)putchar(s[--l]);
    if(las)putchar('\n');else putchar(' ');
}
int lowbit(int x) { return x & (-x); }
template <class T>
T big(const T &a1, const T &a2) {return a1 > a2 ? a1 : a2;}
template <class T>
T sml(const T &a1, const T &a2) {return a1 < a2 ? a1 : a2;}
template <typename T, typename... R>
T big(const T &las, const R &... r) {return big(las, big(r...));}
template <typename T, typename... R>
T sml(const T &las, const R &... r) {return sml(las, sml(r...));}
void debug_out() { cout << '\n'; }
template <typename T, typename... R>
void debug_out(const T &las, const R &... r) {
    cout << las << " ";
    debug_out(r...);
}
#ifdef LH_LOCAL
#define debug(...) cout << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__);
#else
#define debug(...) ;
#endif
/*================Header Template==============*/
const int mod = 998244353;// 998244353
const int INF = 0x3f3f3f3f;
int ksm(int a, int64 b, int kmod = mod) {int res = 1;for(;b > 0;b >>= 1, a = (int64)a * a % kmod) if(b &1) res = (int64)res * a % kmod;return res;}
const int MXN = 2e5 + 5;

int n, m;
class node{
	public:
	int a, b;
	void Rd() {
		a = read(), b = read();
	}
};
node A, B;
int ans;
int is(node A, node B) {
	if(A.a + A.b == B.a + B.b) return 1;
	if(A.a - A.b == B.a - B.b) return 2;
	if(abs(A.a - B.a) + abs(A.b - B.b) <= 3) return 3;
	return 0;
}
void work() {
	A.Rd(), B.Rd();
	if(A.a == B.a && A.b == B.b) ans == 0;
	else if(is(A, B)) ans = 1;
	else {
		node C = A;
		int64 cha = A.b - A.a;
		int64 he = B.a + B.b;
		A.a = (he - cha) / 2;
		A.b = A.a + cha;
		if(is(A, B)) ans = 2;
		else ans = 3;
		A = C;
		cha = B.b - B.a;
		he = A.a + A.b;
		A.a = (he - cha) / 2;
		A.b = he - A.a;
		if(is(A, B)) ans = 2;
		else ans = min(ans, 3);
	}
	printf("%d\n", ans);
}
int main() {
#ifdef LH_LOCAL
    freopen("D:/ACM/mtxt/in.txt", "r", stdin);
    // freopen("D:/ACM/mtxt/out.txt", "w", stdout);
#endif
    for(int cas = 1, tim = 1; cas <= tim; ++ cas) {
        work();
    }
#ifdef LH_LOCAL
    cout << "time cost:" << 1.0 * clock() / CLOCKS_PER_SEC << "s" << endl;
#endif
    return 0;
}