#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int j, temp, cnt = 1;
int main() {
  for (j = 1; j <= 4; j++) {
    cin >> temp;
    v.push_back(temp);
  }
  sort(v.begin(), v.end());
  for (j = 0; j < v.size() - 1; j++) {
    if (v[j] != v[j + 1]) {
      cnt++;
    }
  }
  cout << 4 - cnt;
}
