#include<iostream>
#include<math.h>
using namespace std;

struct dot{
	int x;
	int y;
};

int main(){
	
	dot a1, a2;
	int s;
	
	cin>>a1.x>>a1.y>>a2.x>>a2.y;
	
	if(a1.x==a2.x || a1.y==a2.y){
		s=2;
	}
	else if(abs(a1.x-a2.x)==abs(a1.y-a2.y)){
		s=1;
	}
	else{
		s=0;
	}
	
	cout<<s;
	
}