#include <iostream>
#include <cmath>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	
	long long x1,y1,x2,y2;
	long long raz1,raz2;
	cin>>x1>>y1;
	cin>>x2>>y2;
	raz1=abs(x2-x1);
	raz2=abs(y2-y1);
	if((raz1==0)||(raz2==0)){
		cout<<2;
	}else if(raz1==raz2){
		cout<<1;
	}else{
		cout<<0;
	}
	
	return 0;
}