#include <bits/stdc++.h>
using namespace std;
int horseshoe_needed_to_buy(vector<int> horseshoe_color) {
  sort(horseshoe_color.begin(), horseshoe_color.end());
  int horseshoe_to_buy = 0;
  for (int i = 1; i < 4; i++) {
    if (horseshoe_color[i] == horseshoe_color[i - 1]) {
      horseshoe_to_buy++;
    }
  }
  return horseshoe_to_buy;
}
int main() {
  vector<int> horseshoe_color(4);
  for (int i = 0; i < 4; i++) {
    cin >> horseshoe_color[i];
  }
  cout << horseshoe_needed_to_buy(horseshoe_color) << endl;
}
