#include <bits/stdc++.h>
using namespace std;
int main() {
  int s1, s2, s3, s4;
  cin >> s1 >> s2 >> s3 >> s4;
  unordered_set<int> s;
  s.insert(s1);
  s.insert(s2);
  s.insert(s3);
  s.insert(s4);
  int si = s.size();
  if (si == 4)
    cout << 0;
  else if (si == 3)
    cout << 1;
  else if (si == 2)
    cout << 2;
  else
    cout << 3;
  return 0;
}
