#include <bits/stdc++.h>
int main() {
  int a, b, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  int ans = 0;
  if (a == b) {
    ans++;
  } else if (b == c) {
    ans++;
  } else if (b == d) {
    ans++;
  }
  if (a == c) {
    ans++;
  } else if (c == d) {
    ans++;
  }
  if (a == d) {
    ans++;
  }
  printf("%d", ans);
  return 0;
}
