#include <iostream>
using namespace std;
int main()
{
    int X1, Y1, X2, Y2;
    cin >> X1 >> Y1 >> X2 >> Y2;
    int a = abs(X1 - X2);
    int b = abs(Y1 - Y2);
    if (b == a && X1 != X2 && Y1 != Y2)
        cout << 1;
    else if ((X1 == X2 && Y1 != Y2) || (X1 != X2 && Y1 == Y2))
        cout << 2;
    else cout << 0;
    return 0;
}