#include <iostream>
#include <math.h>
using namespace std;
struct s1 {
	 int x, y;
};
int main()
{   int a = 0;
	s1 t1; s1 t2;
	cin >> t1.x >> t1.y;
	cin >> t2.x >> t2.y;
	if (abs(abs(t1.x) - abs(t2.x)) == abs(abs(t1.y) - abs(t2.y))) a = 1;
	else if (t1.x == t2.x || t1.y == t2.y) a = 2;
	else a = 0;
	cout << a;
	return 0;
}