#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long x1,x2,y1,y2;
    cin>>x1>>y1;
    cin>>x2>>y2;
    long long a = abs(x1-x2), b = abs(y1-y2);
    if((a!=b && (a!=0 && b!=0)) || (a==0 && b==0))
        cout<<"0";
    else{
        if(a==0 || b==0)
            cout<<"2";
        else
            cout<<"1";
    }
}