#include <bits/stdc++.h>

using namespace std;

int main(){
	pair<int,int> t1,t2;
	cin >> t1.first >> t1.second >> t2.first >> t2.second;
	if (t1.first==t2.first||t1.first==t2.second||t1.second==t2.first||t1.second==t2.second) cout << 2;
	else cout << 1;
}