#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int ax ;
    int ay ;
    int bx ;
    int by ;
    cin >> ax ;
    cin >> ay ;
    cin >> bx ;
    cin >> by ;
    if ((ax==bx) || (ay==by) ){
        cout << "2" ;
    }
    else {
        if (abs(ax-bx)==abs(ay-by)){
            cout << "1" ;
        }
        else {
            cout << "0" ;
        }
    }
    return 0;
}