#include<iostream>
#include<cmath>

using namespace std;

struct KordinateTemena{
    int x;
    int y;
};

int main(void)
{
    KordinateTemena tacka1, tacka2;

    cin>>tacka1.x>>tacka1.y;
    cin>>tacka2.x>>tacka2.y;

    if(tacka1.x==tacka2.x || tacka1.y==tacka2.y)
        cout<<"2"<<endl;
    else if((max(tacka1.x,tacka2.x)-min(tacka1.x,tacka2.x))==(max(tacka1.y,tacka2.y)-min(tacka1.y,tacka2.y)))
        cout<<"1"<<endl;
    else
        cout<<"0"<<endl;

    return 0;

}