#include <bits/stdc++.h>
using namespace std;
int main() {
  int ar[102], cnt = 1;
  for (int i = 0; i < 4; i++) {
    cin >> ar[i];
  }
  sort(ar, ar + 4);
  for (int i = 0; i < 3; i++) {
    if (ar[i] != ar[i + 1]) cnt++;
  }
  cout << 4 - cnt << endl;
  return 0;
}
