#include <bits/stdc++.h>
using namespace std;
int main() {
  int colors[4];
  int count = 0;
  cin >> colors[0] >> colors[1] >> colors[2] >> colors[3];
  for (int i = 0; i < 4; i++)
    for (int j = i + 1; j < 4; j++)
      if (colors[i] == colors[j]) colors[j] = -1;
  for (int i = 0; i < 4; i++)
    if (colors[i] == -1) count++;
  cout << count;
  return 0;
}
