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

int main() {
  ll r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  if (r1 == r2 && c1 == c2)
    cout << 0 << endl;
  else if (r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2 ||
           abs(r1 - r2) + abs(c1 - c2) <= 3)
    cout << 1 << endl;
  else if (abs(r1 + c1 + r2 + c2) % 2LL == 0)
    cout << 2 << endl;
  else {
    if (abs(r1 - c1 - r2 + c2) <= 5 || abs(r1 + c1 - r2 - c2) <= 5)
      cout << 2 << endl;
    else
      cout << 3 << endl;
  }
  return 0;
}

#line 1 "C.cpp"
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);

	int ans;
	if(std::abs(a + b) % 2 == std::abs(c + d) % 2) ans = 2;
	else ans = 3;
	if(a == c and b == d) ans = 0;
	if(a + b == c + d) ans = std::min(ans, 1);
	if(a - b == c - d) ans = std::min(ans, 1);

	for(int i = a - 2; i <= a + 2; i++) {
		for(int j = b - 2; j <= b + 2; j++) {
			if(i == c and j == d) ans = std::min(ans, 1);
			if(i + j == c + d) ans = std::min(ans, 2);
			if(i - j == c - d) ans = std::min(ans, 2);
			if(std::abs(i - c) + std::abs(j - d) <= 3) ans = std::min(ans, 2);
		}
	}

	std::vector<std::pair<int, int>> v = {{a - 3, b}, {a + 3, b}, {a, b - 3}, {a, b + 3}};
	for(auto [i, j]: v) {
		if(i == c and j == d) ans = std::min(ans, 1);
		if(i + j == c + d) ans = std::min(ans, 2);
		if(i - j == c - d) ans = std::min(ans, 2);
		if(std::abs(i - c) + std::abs(j - d) <= 3) ans = std::min(ans, 2);
	}

	printf("%d\n", ans);
	return 0;
}

// 三手以下
// 2 手判断
// パリティ同じ -> 曲がって行ける
// 異なる -> 四角内で動いてからななめ
// 1 手判断
// もとから
