#include <bits/stdc++.h>

auto main() -> int {
	using i64 = long long;

	std::ios_base::sync_with_stdio(false);

	i64 x1, y1, x2, y2;

	std::cin >> x1 >> y1 >> x2 >> y2;

	if (x1 == x2 || y1 == y2) {
		std::cout << "2\n";
	}
	else {
		const i64 dx = std::abs(x1 - x2);
		const i64 dy = std::abs(y1 - y2);
		
		std::cout << (dx == dy ? "1\n" : "0\n");
	}
}