#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <stack>
#include <utility>
#include <algorithm>
#include <cmath>
#define ll long long
using namespace std;


int main()
{
	ll x,y,x1,y1;
	ll res=0;
	cin >> x >> y;
	cin >> x1 >> y1;
	
	if((x1 == x && y1 != y) || (y1 == y && x1 != x))res = 2;
	else
	{
		x1 = abs(x1-x);
		x = 0;
		y1 = abs(y1-y);
		y = 0;
		
		if(x1 == y1)res = 1;
		else if(x1*2 == y1 || y1*2 == x1)res = 2;
	}
	
	
	
	cout << res;
	
	return 0;
}