#include <bits/stdc++.h>

using namespace std;

int x1, Y1, x2, y2;

int main () {
    cin >> x1 >> Y1 >> x2 >> y2;
    if (Y1 == y2 || x1 == x2) cout << "2";
    else if (x1 - Y1 == x2 - y2) cout << "1";
    else cout << 0;
    return 0;
}