#include <iostream>
using namespace std;
#define lld long long
#include <math.h>
int number_of_squares(long long int x1, long long int y1, long long int x2, long long int y2)
{
	int n;
	if (x1==x2==y1==y2)
			n=0;
	else	
	{
		if(x1==x2||y1==y2)	
			n=2;
		else
		{
			if (x1-x2==y1-y2||x2-x1==y1-y2||x1-x2==y2-y1||x2-x1==y2-y1)
				n=1;
			else
				n=0;
		}
	}
	return n;	
}
int main() {
	long long int x1,y1,x2,y2;
	cin>>x1>>y1;
	cin>>x2>>y2;
	int n=number_of_squares(x1,y1,x2,y2);
	cout<<n;

	return 0;
}