#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>

using namespace std;

int main()
{
	int x1, y1, x2, y2;
	cin >> x1 >> y1;
	cin >> x2 >> y2;
	int r;

	if (x1 == x2 || y1 == y2)
	{
		r = 2;
	}
	else if (x1 == y1 && x2 == y2)
	{
		r = 1;
	}
	else if (abs(x1 - x2) == abs(y1 - y2))
	{
		r = 1;
	}
	else
	{
		r = 0;
	} 

	cout << r;
	return 0;

}