#include <bits/stdc++.h>
using namespace std;
int a1,b1,a2,b2;
int main (){
  cin>>a1>>b1>>a2>>b2;
  if (a1!=a2 and b2!=b1 and (a1-a2)==(b1-b2)){
        cout<<1;
  }
    else if (a1==a2 or b1==b2){
        cout<<2;
    }
    else {
        cout<<0;
    }
  return 0;
}