#include<iostream>
using namespace std;

int main()
{
	int x1, x2, y1, y2;
	cin >> x1 >> y1;
	cin >> x2 >> y2;
	
	int dx = abs(x1 - x2), dy = abs(y1 - y2);

	if (dx == 0 || dy == 0)
		cout << 2;
	else if (dx == dy)
		cout << 1;
	else
		cout << 0;
}