#include <bits/stdc++.h>
using namespace std;
bool f(int a) {
  deque<int> b;
  while (a) {
    b.push_back(a % 10);
    a /= 10;
  }
  sort(b.begin(), b.end());
  for (int i = 0; i < b.size() - 1; i++)
    if (b[i] == b[i + 1]) return false;
  return true;
}
bool solve() {
  deque<int> a(4);
  for (int i = 0; i < 4; i++) cin >> a[i];
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size() - 1; i++)
    for (int j = i + 1; j < a.size(); j++)
      if (a[i] == a[j]) {
        a.erase(a.begin() + j - 1);
        j--;
      }
  cout << 4 - a.size();
  return true;
}
int main() { solve(); }
