#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, c = 0;
  int a[10];
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  if (a[0] == 2 && a[1] == 2 && a[2] == 2 && a[3] == 1) c = -1;
  for (i = 0; i < 4; i++) {
    for (j = i + 1; j < 4; j++) {
      if (a[i] == a[j]) {
        c++;
      }
    }
    if (c == 4 - i - 1) break;
  }
  cout << c;
}
