#include <iostream>

using namespace::std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long x1, y1, x2, y2;
	cin >> x1 >> y1;
	cin >> x2 >> y2;
	long long dx = x2 - x1, dy = y2 - y1;
	if (dx == 0 || dy == 0) cout << 2;
	else if (dx == dy) cout << 1;
	else cout << 0;
	return 0;
}