// ConsoleApplication10.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <math.h>

int main()
{
    long int x1, x2, y1, y2,br=0;
    scanf_s("%d %d", &x1, &y1);
    scanf_s("%d %d", &x2, &y2);
    if (x1 == x2 || y1 == y2) {
        printf("2");
        br++;
    }
    if (abs(x1 - x2) == abs(y1 - y2)&& x1 != x2 && y1 != y2) {
        printf("1");
        br++;
    }
    else if (br == 0) {
        printf("0");
    }
}