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

int x1,x,x2,z1,z2,br=0;


int main(){
    cin >> x1 >> z1 >> x2 >> z2;
        
        if(x1!=x2 and z1!=z2){
            br=1;
            }
            else if (x1=x2 or z1=z2){
                br=2;
            }
            else br=0;
    
    
    cout << br << endl;
    
    
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int x1,x,x2,z1,z2,br=0;


int main(){
    cin >> x1 >> z1 >> x2 >> z2;
        
        if(x1!=x2 and z1!=z2){
            br=1;
            }
            else if (x1=x2 or z1=z2){
                br=2;
            }
            else br=0;
    
    
    cout << br << endl;
    
    
    return 0;
}