#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4];
  while (~scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3])) {
    sort(a, a + 4);
    int ans = 1;
    for (int i = 1; i <= 3; i++)
      if (a[i] != a[i - 1]) ans++;
    cout << 4 - ans << endl;
  }
  return 0;
}
