#include <bits/stdc++.h>
using namespace std;
long long a1,b1,a2,b2;
int main(){
    cin>>a1>>b1;
    cin>>a2>>b2;

    if( (a1==a2) or (b1==b2) ){
        cout<<2<<endl;
    }

    else if( (abs(a1-a2))==(abs(b1-b2)) ){
        cout<<1<<endl;
    }

    else{
        cout<<0<<endl;
    }


return 0;}