#include <bits/stdc++.h>

using namespace std;

int x1,Y1,x2,Y2;

int main() {
    cin>>x1>>Y1>>x2>>Y2;
    if(abs(x1-x2)==abs(Y1-Y2)) {
        cout<<1<<endl;
    }
    else if((x1==x2) or (Y1==Y2)) {
        cout<<2<<endl;
    }
    else
        cout<<0<<endl;
return 0;
}