#include <bits/stdc++.h>
int main() {
  int i, j, k, c = 0;
  int s[4];
  for (j = 0; j < 4; j++) scanf("%d", &s[j]);
  for (k = 0; k < 4; k++) {
    for (j = k + 1; j < 4; j++) {
      if (s[k] == s[j]) s[j] = 0;
    }
  }
  for (j = 0; j < 4; j++) {
    if (s[j] == 0) c++;
  }
  printf("%d\n", c);
}
