#include <iostream>

using namespace std;

int main()
{
    int x1,x2,y1,y2,p1,p2;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    if(x1==x2)
        cout << 2;
    else if(y1==y2)
        cout << 2;
    else
    {
        if(x2>x1)
            p1=x2-x1;
        else
            p1=x1-x2;
        if(y2>y1)
            p2=y2-y1;
        else
            p2=y1-y2;
        if(p2==p1)
            cout << 1;
        else
            cout << 0;
    }
    return 0;
}