#include <bits/stdc++.h>
int main(void) {
  int a, b, c, d, cnt = 0;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  if (a == b) cnt++;
  if (a == c) cnt++;
  if (a == d) cnt++;
  if (b == c) cnt++;
  if (b == d) cnt++;
  if (c == d) cnt++;
  if (cnt == 6) printf("3");
  if (cnt == 3) printf("2");
  if (cnt == 2) printf("2");
  if (cnt == 1) printf("1");
  if (cnt == 0) printf("0");
}
