#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int main() {
int s[4];
int ans = 0;
cin >> s[0] >> s[1] >> s[2] >> s[3];
sort(s, s + 4);
for(int i = 0; i < 3; ++i) {
if(s[i] == s[i+1]) {
ans++;
}
}
cout << ans << endl;
return 0;
}