#include <iostream>

int main()
{
    int x1, y1, x2, y2;
    scanf_s("%d", &x1);
    scanf_s("%d", &y1);
    scanf_s("%d", &x2);
    scanf_s("%d", &y2);

    if (x1 == x2 || y1 == y2)
    {
        printf("2");
    }
    else if (abs(x1 - x2) == abs(y1 - y2))
    {
        printf("1");
    }
    else
    {
        printf("0");
    }
}