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

    if(a==a1==b==b1){
        cout<<0;
    }
    else if((a==a1) or (b==b1)){
        cout<<2;
    }
    else if(abs(a-a1)==abs(b-b1)){
        cout<<1;
    }
    else{
        cout<<0;
    }

return 0;
}