#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n;
  long long x[4];
  n = 0;
  cin >> x[0];
  for (i = 1; i < 4; i++) {
    cin >> x[i];
    for (j = i - 1; j >= 0; j--) {
      if (x[i] == x[j]) n++;
    }
  }
  if (n == 6)
    cout << 3 << endl;
  else if (n == 3 || n == 2)
    cout << 2 << endl;
  else if (n == 1)
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}
