#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a==c||b==d)
    {
        cout<<2;
    }
    else if(abs(a-c)==abs(b-d)||abs(a-d)==abs(b-c))
    {
        cout<<1;
    }
    else
    {
        cout<<0;
    }

}