#include <bits/stdc++.h>
using namespace std;
int main() {
  int word[4];
  for (int i = 0; i < 4; i++) {
    cin >> word[i];
  }
  int number = 0;
  sort(word, word + 4);
  for (int i = 0; i < 3; i++) {
    for (int j = i + 1; j < 4; j++) {
      if (word[i] == word[j]) {
        number++;
        i = j - 1;
      } else {
        i = j - 1;
        break;
      }
    }
  }
  cout << number;
  return 0;
}
