#include <bits/stdc++.h>
int main() {
  long long int s1, s2, s3, s4;
  int cnt = 0;
  scanf("%lld%lld%lld%lld", &s1, &s2, &s3, &s4);
  if (s1 == s2 || s1 == s3 || s1 == s4) cnt++;
  if (s2 == s3 || s2 == s4) cnt++;
  if (s3 == s4) cnt++;
  printf("%d\n", cnt);
  return 0;
}
