#include <iostream>

using namespace std;

int main()
{
    float x1,y1,x2,y2,broj;
    broj=0;
    cin>>x1;
    cin>>y1;
    cin>>x2;
    cin>>y2;
    if(x1==x2 && y1!=y2)
    {
        cout<<2;
        broj=1;
    }
    if(x1!=x2 && y1==y2)
    {
        cout<<2;
        broj=1;
    }
    if(x1==x2 && y1==y2)
    {
        cout<<0;
        broj=1;
    }
    if(x1==y1 && x2==y2 && x1!=x2 && y1!=y2)
    {
        cout<<1;
        broj=1;
    }
    if(broj!=1)
        cout<<0;
    
    return 0;
}