#include<iostream>
#include<cmath>
using namespace std;
long long x,x2,y,y2,br,x3,y3;
double d,a,b,d2;
int main(){
	cin>>x>>y;
	cin>>x2>>y2;
	d=sqrt(pow(x2-x,2)+pow(y2-y,2));
	x3=x2;
	y3=y;
	a=abs(x3-x);
	b=abs(y3-y2);
	d2=sqrt(a*a+b*b);
	//cout<<"str a:"<<a<<" ,str b: "<<b<<endl;
	if(x==x2 || y==y2)br=2;
	else {
		if(a!=b)br=0;
		else br=1;
	}
	cout<<br;
	return 0;
}