#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int x,y,x1,y1;
	cin>>x>>y>>x1>>y1;
	if(x==x1 or y==y1) cout<<"2";
	else{
		if(abs(x-x1)==abs(y-y1)) cout<<"1";
		else cout<<"0";
	}
	return 0;
}