#include <bits/stdc++.h>

using namespace std;

int x1, y1, x2, y2, ans;

int main(){
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	cin >> x1 >> y1 >> x2 >> y2;
	if(x1 == x2 or y1 == y2){
		ans = 2;
	} else if(abs(x1-x2) == abs(y1-y2)){
		ans = 1;
	}
	cout << ans << '\n';
}