#include <iostream>
#include<math.h>
using namespace std;


int main() {
	long int x1=0, x2=0, y1=0, y2=0, raz1, raz2;
		cin >> x1 >> y1;
		cin >> x2 >> y2;
		if (x2-x1==0 || y2-y1==0) {
			cout << "2";
		}
		else {
			raz1 = abs(x2 - x1);
			raz2 = abs(y2 - y1);
			if (raz1 == raz2) cout << "1";
			else cout << "0";
		}

	return 0;
}