#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, l = 0;
  cin >> a >> b >> c >> d;
  map<int, int> love;
  love[a]++;
  love[b]++;
  love[c]++;
  love[d]++;
  for (auto x : love) {
    if (x.second != 1) l = l + (x.second - 1);
  }
  cout << l;
  return 0;
}
