#include <iostream>
#include <stdio.h>

int main() {
	double x1, x2, y1, y2, a = 0, minx, maxx, miny, maxy, lx, ly;
	std::cin >> x1 >> y1 >> x2 >> y2;
	if (x1 < x2) {
		maxx = x2;
		minx = x1;
	}
	else {
		minx = x2;
		maxx = x1;
	}
	if (y1 < y2) {
		maxy = y2;
		miny = y1;
	}
	else {
		maxy = y1;
		miny = y2;
	}
	lx = maxx - minx;
	ly = maxy - miny;
	if (x1 == x2 || y1 == y2) {
		a = 2;
	}
	if (ly == lx) {
		a = 1;
	}
	std::cout << a;
}