#include <bits/stdc++.h>
using namespace std;
void solve() {
  vector<long long> v;
  long long c = 0;
  for (long long i = 0; i < 4; i++) {
    long long a;
    cin >> a;
    ;
    v.push_back(a);
  }
  sort((v).begin(), (v).end());
  ;
  for (long long i = 0; i < 4; i++) {
    if (v[i] != v[i + 1]) c++;
  }
  cout << 4 - c << endl;
}
void init_code() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int32_t main() {
  auto t1 = chrono::high_resolution_clock::now();
  ;
  init_code();
  solve();
  auto t2 = chrono::high_resolution_clock::now();
  std::chrono::duration<double, milli> elapsed = t2 - t1;
  cerr << "Program Runtime is: " << elapsed.count() << " milliseconds." << endl;
  ;
  return 0;
}
