#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 10;
map<int, int> ma;
int main() {
  for (int i = 0; i < (int)(4); ++i) {
    int a;
    cin >> a;
    ma[a]++;
  }
  map<int, int>::iterator it = ma.begin();
  int ans = 0;
  for (; it != ma.end(); ++it) {
    ans += it->second - 1;
  }
  cout << ans << endl;
}
