#include <bits/stdc++.h>
using namespace std;
int s;
std::set<int> ans;
int main(int argc, char const *argv[]) {
  for (int i = 0; i < 4; i++) {
    scanf("%d", &s);
    ans.insert(s);
  }
  printf("%d\n", 4 - ans.size());
  return 0;
}
