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

using namespace std;

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

	if (x1==x2 || y1==y2)
	{
		cout << 2 << endl;
	}

	else if ((abs(abs(x1) - abs(x2))) == (abs(abs(y1) - abs(y2))))
	{
		cout << 1 << endl;
	}

	else
	{
		cout << 0 << endl;
	}


	return 0;
}