#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long a, b, c, d, e, f, g, h, i, j, k, l, m, n, t, ans = 0;
  set<long long> s;
  for (i = 0; i < 4; i++) {
    cin >> a;
    s.insert(a);
  }
  cout << 4 - s.size() << endl;
}
