#include <iostream>
#include <cmath>

int main() {
	std::ios_base::sync_with_stdio(false);

	int x1, x2, y1, y2;

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

	if (x1 == x2 || y1 == y2) {
		std::cout << 2;
	}
	else if (std::abs(x2 - x1) == std::abs(y2 - y1)) {
		std::cout << 1;
	}
	else std::cout << 0;

	system("pause");

	return 0;
}