#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

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

    long long int x1,x2,y1,y2;
    long long int min_x , min_y;
    long long int x_duzina ,y_duzina;
    bool x_paralelna, y_paralelna;
    x_paralelna = false;
    y_paralelna = false;

    cin >> x1 >> y1;
    cin >> x2 >> y2;

    if(x1 == x2) x_paralelna = true;
    if(y1 == y2) y_paralelna = true;

    if(x_paralelna && y_paralelna){
        cout << 0;
    } else {
        if((x_paralelna == true) && (y_paralelna == false)){
            cout << 2;
        }
        if((y_paralelna == true) && (x_paralelna == false)){
            cout << 2;
        }
        if((x_paralelna == false) && (y_paralelna == false)){
            min_x = min(x1,x2);
            min_y = min(y1,y2);
            if(min_x >= 0)
            {
                x1 = x1 - abs(min_x);
                x2 = x2 - abs(min_x);
            }
            if(min_y >= 0)
            {
                y1 = y1 - abs(min_y);
                y2 = y2 - abs(min_y);
            }
            if(min_x < 0)
            {
                x1 = x1 + abs(min_x);
                x2 = x2 + abs(min_x);
            }
            if(min_y < 0)
            {
                y1 = y1 + abs(min_y);
                y2 = y2 + abs(min_y);
            }

            x_duzina = max(x1,x2);
            y_duzina = max(y1,y2);

           if(x_duzina == y_duzina)
            {
                cout << 1;
            } else {
                cout << 0;
            }

        }
    }
}