#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> TheNumbers(4);
  cin >> TheNumbers[0] >> TheNumbers[1] >> TheNumbers[2] >> TheNumbers[3];
  sort(TheNumbers.begin(), TheNumbers.end());
  TheNumbers.erase(unique(TheNumbers.begin(), TheNumbers.end()),
                   TheNumbers.end());
  cout << 4 - TheNumbers.size() << endl;
  return 0;
}
