#include<stdio.h>
#include<math.h>
int main()
{
    int x1, x2, y1, y2;
    scanf("%d", &x1);
    scanf("%d", &y1);
    scanf("%d", &x2);
    scanf("%d", &y2);
    if((x1 == x2)||(y1 == y2))
    printf("%d", 2);
    else
    if(abs(x1 - x2) == abs(y1 - y2))
    printf("%d", 1);
    else 
    printf("%d", 0);
    return 0;
}