#include <bits/stdc++.h>
using namespace std;
int main() {
  int shoes[4];
  int i;
  int duplicate_count = 0;
  for (i = 0; i < 4; i++) {
    scanf("%d", &shoes[i]);
  }
  sort(shoes, shoes + 4);
  int initial = shoes[0];
  for (i = 1; i < 4; i++) {
    if (initial == shoes[i]) {
      duplicate_count++;
    }
    initial = shoes[i];
  }
  printf("%d\n", duplicate_count);
  return 0;
}
