#include <bits/stdc++.h>
using namespace std;
int ucitaj()
	{
		bool minus=false;
		int rez=0;
		char ch;
		ch=getchar();
		while (true)
		{
			if (ch=='-') break;
			if (ch>='0' or ch<='9')break;
			ch=getchar();
		}
		if (ch=='-') minus=true; else rez=(ch-'0');
		while (true)
		{
			ch=getchar();
			if (ch<'0' or ch>'9') break;
			rez=rez*10+(ch-'0');
		}
		if (minus)
		{
			return -rez;
		}
		else
		{
			return rez;
		}
	}
int main()
{
	int x1,x2,y1,y2,s;
	x1=ucitaj();
	y1=ucitaj();
	x2=ucitaj();
	y2=ucitaj();
	if (x1==x2 or y1==y2)
	{
		s=2;
	}
	else
	{
		if (abs(x1-x2)==abs(y1-y2))
		{
			s=1;
		}
		else s=0;
	}
	printf("%d",s);
}