#include <bits/stdc++.h>
using namespace std;
int main() {
  int n[4];
  int counter = 0;
  for (int i = 0; i < 4; i++) cin >> n[i];
  for (int i = 0; i < 4; i++) {
    for (int j = i + 1; j < 4; j++) {
      if ((n[i] == n[j]) && (i != j)) counter++;
    }
  }
  if (counter == 3)
    cout << 2 << endl;
  else if (counter == 6)
    cout << 3 << endl;
  else
    cout << counter << endl;
  return 0;
}
