#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
#define GETVEC(v) for(auto& m : v) cin >> m;
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
	int ans = -1;
	if (r1 == r2 && c1 == c2)
	{
		ans = 0;
	}
	else if (abs(r1 - r2) + abs(c1 - c2) <= 3 || abs(r1 - r2) == abs(c1 - c2))
	{
		ans = 1;
	}
	else if ((r1 + c1) % 2 == (r2 + c2) % 2)
	{
		ans = 2;
	}
	else
	{
		ans = 3;
		for (int r = r1 - 2; r <= r1 + 2; ++r)
		{
			for (int c = c1 - 2; c <= c1 + 2; ++c)
			{
				if (abs(r - r2) + abs(c - c2) <= 3
					|| abs(r - r2) == abs(c - c2))
				{
					ans = 2;
				}
			}
		}
	}

	cout << ans << endl;
}

#include <bits/stdc++.h>

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  void solve() {
    LL x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 == x2 && y1 == y2) {
      cout << 0 << endl;
    } else if (x1 + y1 == x2 + y2 || x1 - y1 == x2 - y2 || abs(x1 - x2) + abs(y1 - y2) <= 3) {
      cout << 1 << endl;
    } else if (abs(x1 + y1 - x2 - y2) <= 3 || abs(x1 - y1 - x2 + y2) <= 3 || abs(x1 - x2) + abs(y1 - y2) <= 6 || (x1 + y1) % 2 == (x2 + y2) % 2) {
      cout << 2 << endl;
    } else {
      cout << 3 << endl;
    }
  }
};

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);

  Problem::Solver sol;
  sol.solve();
  return 0;
}
