#include <iostream>

using namespace std;

int main()
{
    long x1, x2, y1, y2, dx, dy;
    cin>>x1>>y1>>x2>>y2;
    dx=x2-x1;
    dy=y2-y1;

    if(dx!=0 && dy!=0)
    {
        if(dy/dx==1 || dy/dx==0)
            cout<<1;
        else
            cout<<0;
    }

    else
        cout<<2;

    return 0;
}