#include <bits/stdc++.h>

using namespace std;

bool check(pair<int, int> t1, pair<int, int> t2) {
	int s1 = abs(t1.first - t2.first), s2 = abs(t1.second - t2.second);

	return s1 == s2;
}

int main() {
	pair<int, int> t1, t2;
	int res = 0;

	cin >> t1.first >> t1.second >> t2.first >> t2.second;

	if (check(t1, t2)) {
		res = 1;
	} else if (t1.first == t2.first || t1.second == t2.second) {
		res = 2;
	}

	cout << res;
}