#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int ax, ay, bx, by;

    cin >> ax >> ay;

    cin >> bx >> by;

    int resenje;

    if(abs(ay - by) == 0)
    {
        resenje = 2;
        cout << resenje;
    }
    else if(abs(ax - bx) == 0)
    {
        resenje = 2;
        cout << resenje;
    }
    else if(abs(ay - by) == abs(ax - bx))
    {
        resenje = 1;
        cout << resenje;
    }
    else
    {
        resenje = 0;
        cout << resenje;
    }
    return 0;
}