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