#include <stdio.h>
#include <stdlib.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(x1-x2)==abs(y1-y2))
	{
		printf("1");
	}
	else if(x1==x2 && y1==y2)
	{
		printf("0");
	}
	else
	{
		printf("0");
	}
getchar();
getchar();
}