#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a==b&&c==d){
        cout<<4;
    }
    else if(a==c||b==d){
        cout<<2;
    }
    else if(a==d||b==c){
        cout<<1;
    }
    else if(abs (a-c)==abs (b-d)){
        cout<<1;
    }
    else {
        cout<<0;
    }
}