#include <bits/stdc++.h>
using namespace std;
int main() {
  unordered_map<int, int> m;
  long long c = 0;
  for (int i = 0; i < 4; i++) {
    int a;
    cin >> a;
    m[a]++;
  }
  for (auto it : m) {
    if (it.second > 1) c += it.second - 1;
  }
  cout << c << " ";
}
