#include <iostream>
#include <cmath>

using namespace std;

main(){
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	int k=0;
	if(y1==y2)
		k+=2;
	else if(x1==x2)
	 	k+=2;
	else if(abs(y2-y1)==abs(x1-x2))
	 k++;
	 cout<<k;
	
}