#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, s = 0;
  cin >> a >> b >> c >> d;
  if (a == b || a == c || a == d) s++;
  if (b == c || b == d) s++;
  if (c == d) s++;
  cout << s;
  return 0;
}
