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