#include <bits/stdc++.h>
using namespace std;
int main() {
  unordered_set<long long> counter;
  long long num;
  for (int i = 0; i < 4; i++) {
    cin >> num;
    counter.insert(num);
  }
  cout << 4 - counter.size() << "\n";
  return 0;
}
