#include <bits/stdc++.h>

using namespace std;

int main()
{

    pair<int, int> a;
    pair<int, int> b;

    cin >> a.first >> a.second;
    cin >> b.first >> b.second;


    if(a.first == b.first || a.second == b.second){
        cout << 2;
    }else{
        int distA = abs(a.first - b.first);
        int distB = abs(a.second - b.second);

        if(distA == distB){
            cout << 1;
        }else{
            cout << 0;
        }
    }


    return 0;
}