#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4];
  int c = 0;
  for (int i = 0; i < 4; ++i) {
    cin >> a[i];
    for (int j = 0; j < i; ++j) {
      if (a[j] == a[i]) {
        ++c;
        break;
      }
    }
  }
  cout << c << '\n';
}
