#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int s1, s2, s3, s4;
  long long int x;
  cin >> s1 >> s2 >> s3 >> s4;
  if (s1 == s2 && s2 == s3 && s3 == s4) {
    cout << "3";
  } else if ((s1 != s2 && s2 == s3 && s3 == s4) ||
             (s1 == s2 && s2 != s3 && s3 == s4) ||
             (s1 == s2 && s2 == s3 && s3 != s4) ||
             (s1 != s2 && s2 == s3 && s3 != s4) ||
             (s1 == s2 && s2 != s3 && s3 == s4) ||
             (s1 != s2 && s2 != s3 && s3 != s4 && s1 == s3 && s2 == s4)) {
    cout << "2";
  } else if ((s1 != s2 && s2 != s3 && s3 == s4) ||
             (s1 != s2 && s2 == s3 && s3 != s4 && s1 != s4) ||
             (s1 != s2 && s2 != s3 && s3 != s4 && s2 == s4) ||
             (s1 != s2 && s2 != s3 && s3 != s4 && s1 == s4) ||
             (s1 == s2 && s2 != s3 && s3 != s4 && s2 != s4) ||
             (s1 != s2 && s2 != s3 && s3 != s4 && s1 == s3)) {
    cout << "1";
  } else {
    cout << "0";
  }
}
