#include <bits/stdc++.h>
#define ll long long

using namespace std;

int x;
int y;
int x2;
int y2;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> x >> y;
	cin >> x2 >> y2;
	if ((x == x2) || (y == y2))
        cout << 2;
    else if (abs(x2 - x) == abs(y2 - y))
        cout << 1;
    else
        cout << 0;
	return 0;
}