#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, a[5];
  while (scanf("%d", &a[0]) == 1) {
    int counti = 0;
    for (i = 1; i < 4; i++) scanf("%d", &a[i]);
    sort(a, a + 4);
    for (i = 0; i < 3; i++)
      if (a[i] == a[i + 1]) counti++;
    printf("%d\n", counti);
  }
  return 0;
}
