#include <iostream>
#include <algorithm>
#include <ctime>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

int main() {
    long long x, y, p, q;
    cin >> x >> y >> p >> q;
    if (abs(x - y) == abs(p - q))
        cout << 1;
    else if (x == p || y == q)
        cout << 2;
    else
        cout << 0;

    return 0;
}