#include <bits/stdc++.h>
#include <utility>

using namespace std;

int main()
{
	pair<long long, long long> a,b;
	scanf("%lli %lli",&a.first,&a.second);
	scanf("%lli %lli",&b.first,&b.second);

	if(a.first == b.first || a.second == b.second)
		printf("2");
	else if(abs(a.first - b.first) == abs(a.second-b.second))
		printf("1");
	else
		printf("0");
	return 0;
}