#include <iostream>

using namespace std;

int main()
{
int a;
int b;
int m;
int n;

cin>>a; cin>>b;
cin>>m; cin>>n;

if(a==m && b!=n){
cout<< "2" <<endl;
}

if(b==n && a!=m){
cout<< "2" <<endl;
}

if(a!=m && b!=n){
cout<< "1" <<endl;
}

if(a==m && b==n){
cout<< "0" <<endl;
}

return 0;
}