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

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