#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a;
  int x, count = 0;
  for (int i = 0; i < 4; i++) {
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < 3; i++) {
    if (a[i] == a[i + 1]) count++;
  }
  cout << count;
  return 0;
}
