#include <bits/stdc++.h>

using namespace std;
long long a1,a2,b1,b2;
int main (){
    scanf("%lld %lld",&a1,&a2);
    scanf("%lld %lld",&b1,&b2);
    if(a1==a2 and b1==b2){
        printf("%d\n",1);
        return 0;
    }
    if(a1==b1 || b2==a2){
        printf("%d\n",2);
        return 0;
    }
    if(abs(a1-b1)==abs(a2-b2)){
        printf("%d\n",1);
        return 0;
    }
    printf("%d\n",0);
return 0;
}