#include <bits/stdc++.h>
int main() {
  int A[6] = {};
  A[5] = -1;
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  for (short i = 0; i < 4; ++i) std::cin >> A[i];
  std::sort(A, A + 4);
  for (short i = 0; i < 4; ++i) {
    if (A[5] == A[i])
      ++A[4];
    else
      A[5] = A[i];
  }
  std::cout << A[4];
}
