#include <bits/stdc++.h>
using namespace std;
int main() {
  int c = 0;
  string s[4];
  for (int i = 0; i < 4; i++) {
    cin >> s[i];
  }
  int i = 0;
  while (i < 3) {
    bool b = 0;
    string k = s[i];
    for (int j = i + 1; j < 4; j++) {
      if (k == s[j]) c++;
      if (c > 1) b = 1;
    }
    i++;
    if (b) break;
  }
  cout << c;
  return 0;
}
