#include <bits/stdc++.h>
using namespace std;
int find(int rep[], int x[], int ind) {
  for (int i = 0; i < 4; ++i) {
    if (rep[i] != 0 && x[i] == x[ind] && i != ind) return 1;
  }
  return 0;
}
int rep[4];
int main(void) {
  int x[4];
  for (int i = 0; i < 4; ++i) cin >> x[i];
  int mx = 0;
  int cnt;
  for (int i = 0; i < 4; ++i) {
    cnt = 0;
    if (find(rep, x, i)) continue;
    for (int j = i + 1; j < 4; ++j) {
      if (x[i] == x[j]) cnt++;
    }
    rep[i] = cnt;
  }
  int sum = 0;
  for (int i = 0; i < 4; ++i)
    if (rep[i] != 0) sum += rep[i];
  cout << sum;
}
