#include <bits/stdc++.h>
int main() {
  int v[4], count = 0, i, j;
  scanf("%d", &v[0]);
  scanf("%d", &v[1]);
  scanf("%d", &v[2]);
  scanf("%d", &v[3]);
  for (i = 0; i < 4; i++) {
    for (j = i + 1; j < 4; j++) {
      if (v[i] == v[j]) {
        count++;
        break;
      }
      if (count == 3) break;
    }
    if (count == 3) break;
  }
  printf("%d", count);
  return 0;
}
