#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long x1,x2,y1,y2,r1,r2;
    cin>>x1>>x2;
    cin>>y1>>y2;
    if(x1==y1&&x2==y2){
        cout<<4;
    }
    else if(x1==y1||x2==y2){
        cout<<2;
    }
    else if(x1==y2||x2==y1){
        cout<<1;
    }
    else{
        r1=x1-y1;
        r1=abs(r1);
        r2=x2-y2;
        r2=abs(r2);
        if(r1==r2){
            cout<<1;
        }
        else{
            cout<<0;
        }
    }
}