#include <stdio.h>
#include <math.h>

int main()
{
	int x1,x2,y1,y2;
	
	scanf("%d", &x1);
	scanf("%d", &y1);
	scanf("%d", &x2);
	scanf("%d", &y2);
	
	if(x1==x2 || y1==y2)
		printf("2");
	else
	{
		if(abs(x2-x1)==abs(y2-y1))
			printf("1");
		else
			printf("0");
	}
	
	return 0;
}