#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> y;
  set<int> p;
  int t;
  int f = 4;
  while (f--) {
    cin >> t;
    y.push_back(t);
    p.insert(t);
  }
  int w = 4 - p.size();
  cout << w << endl;
  return 0;
}
