#include <bits/stdc++.h>
using namespace std;
void precompute(void) {}
int main() {
  int col[4], i, ans;
  precompute();
  while (scanf("%d", &col[0]) != EOF) {
    for (i = 1; i < 4; i++) scanf("%d", &col[i]);
    sort(col, col + 4);
    ans = 4 - (unique(col, col + 4) - col);
    printf("%d\n", ans);
  }
  return 0;
}
