#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
void yash() {
  int arr[4], count = 1;
  for (int i = 0; i < 4; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + 4);
  for (int i = 0; i < 3; i++) {
    if (arr[i] != arr[i + 1]) {
      count++;
    }
  }
  cout << 4 - count << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  yash();
  return 0;
}
