#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int main() {
  int s1, s2, s3, s4;
  int a[4];
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  int i, j, k = 0;
  sort(a, a + 4);
  j = a[0];
  for (i = 1; i < 4; ++i) {
    if (j == a[i]) {
      k++;
    } else
      j = a[i];
  }
  cout << k;
  return 0;
}
