#include <iostream>
using namespace std;


int main(int argc, char** argv) 
{
	long long a1,a2,b1,b2;
	cin>>a1>>b1;
	cin>>a2>>b2;
	
	if(a1-b1==a2-b2)
	cout<<1;
	else
	{
		if(a1==a2||b1==b2)
		{
			cout<<2;
		}
		else
		{
			if(a1!=a2&&b1!=b2)
			{
				cout<<0;
			}
		}
	}
}