#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x1, x2, y1, y2;
    scanf("%d %d", &x1, &y1);
    scanf("%d %d", &x2, &y2);
    if (y1 == y2 || x1 == x2) {
        printf("2");
    }
    else if (abs(y1-y2) == abs(x1-x2)){
        printf("1");
    }
    else
    {
        printf("0");
    }
    return 0;
}