#include <iostream>

using namespace std;

int main()
{
    int xp,yp,xd,yd;
    cin>>xp>>yp>>xd>>yd;
    if(xp==xd or yp==yd)
    {
        cout<<2;
    }
    else if(xp-xd==yp-yd or xp-xd==(yp-yd)*(-1))
    {
        cout<<1;
    }
    else
    {
        cout<<0;
    }

    return 0;
}