#include <iostream>
#include <cmath>
using namespace std;
int main() {
	int x1,y1,x2,y2,d;
	cin>>x1>>y1>>x2>>y2;
	int a=abs(y2-y1),b=abs(x2-x1);
	if(y1 == y2 || x1 == x2)
		cout<<'2';
		else{
	if(a == b)
		cout<<'1';
	else
		cout<<'0';
}
}