#include <iostream>

using namespace std;

int BrojKvadrata(int x1, int y1, int x2, int y2)
{
	if(x1 == x2 || y1 == y2) return 2;
	else if((y2-y1)/(x2-x1) == 1 || (y2-y1)/(x2-x1) == -1) return 1;
	else return 0;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int x1, y1, x2, y2;
	
	cin >> x1 >> y1 >> x2 >> y2;
	
	cout << BrojKvadrata(x1, y1, x2, y2) <<endl;	
}