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