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