#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    long y1, y2, x1, x2, x, y;
    int BrojKvadrata;
    scanf("%ld%ld",&x1,&y1);
    scanf("%ld%ld",&x2,&y2);
    x=labs(x2-x1);
    y=labs(y2-y1);
    if(y1==y2 && x1==x2){
        return 0;
    }
    else if(y1==y2 || x1==x2){
        BrojKvadrata=2;
    }
    else if(x!=y){
        return 0;
    }
    else if(x==y){
        BrojKvadrata=1;
    }
    printf("%d", BrojKvadrata);
}