#include <bits/stdc++.h>

using namespace std;

long long X1,X2,Y1,Y2;

int main(){

    scanf("%lld%lld%lld%lld", &X1, &Y1, &X2, &Y2);

    if(abs(X1-X2) == abs(Y1-Y2)){
        printf("1\n");
        return 0;
    }

    if((X1==X2) or (Y1==Y2)){
        printf("2\n");
        return 0;
    }

    printf("0\n");

 return 0;
}