#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct{
int x;
int y;
}tacka;
int main()
{
    tacka a,b;
    int ind=0;
    scanf("%d",&a.x);
    scanf("%d",&a.y);
    scanf("%d",&b.x);
    scanf("%d",&b.y);
    if(a.x==b.x || a.y==b.y){
        printf("2");
    ind=1;
    }
    if(abs(a.x-b.x)==abs(a.y-b.y)){
        printf("1");
        ind=1;
    }
    if(ind==0)
        printf("0");

    return 0;
}