#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int x_1, y_1, x_2, y_2;

    cin >> x_1 >> y_1 >> x_2 >> y_2;

    if (x_1 == x_2 || y_1 == y_2) {
        cout << 2;
    } else if (abs(x_1 - x_2) == abs(y_1 - y_2)) {
        cout << 1;
    } else {
        cout << 0;
    }
}