#include <bits/stdc++.h>
int s[5], res;
int main() {
  scanf("%d%d%d%d", &s[0], &s[1], &s[2], &s[3]);
  s[4] = s[0];
  std::sort(s, s + 5);
  for (int i = 0; i < 5; i++)
    if (s[i] == s[i + 1]) res++;
  printf("%d", res == 0 ? 0 : res - 1);
}
