#include <iostream>
#include <utility>
#include <cstdlib>

int main()
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);

	std::pair<long long, long long> a, b;

	std::cin >> a.first >> a.second >> b.first >> b.second;

	if (a.first == b.first || a.second == b.second)
		std::cout << 2;
	else if (abs(a.first - b.first) == abs(a.second - b.second))
		std::cout << 1;
	else
		std::cout << 0;

	return 0;
}