#include<iostream>
#include<cmath>
using namespace std;

int main(){
	long x, y , a, b;
	cin>>x>>y;
	cin>>a>>b;
	if(x == a || x == b || y == a || y == b)
		cout<<"2";
		else if(abs(a-x) == abs(b-y) || abs(a-b) == abs(x-y))
			cout<<"1";
			else cout<<"0";
	return 0;	
}