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