#include <iostream>
#include <algorithm>

using namespace std;
int main() {
    int x, y;
    cin >> x >> y;
    int x1, y1;
    cin >> x1 >> y1;
    if (y == y1 || x1 == x)
        cout << 2;
    else
        if (abs(x1-x) != abs(y1-y))
            cout << 0;
        else
            cout << 1;
    return 0;
}