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

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


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