#include <iostream>
using namespace std;

int main()
{
    int x1, x2, y1, y2;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    int xmax, ymax;
    int xmin, ymin;
    xmax = x1;
    ymax = y1;
    if (x2 > xmax)
    {
        xmax = x2;
        xmin = x1;
    }
    else
    {
        xmin = x2;
    }
    if (y2 > ymax)
    {
        ymax = y2;
        ymin = y1;
    }
    else
    {
        ymin = y2;
    }
    if (x1 == x2 || y1 == y2)
    {
        cout << "2";
    }
    else
    {
        if (xmax - xmin == ymax - ymin)
            cout << "1";
        if (xmax - xmin != ymax - ymin)
            cout << "0";
    }

        
}