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