#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, z, c;
  cin >> x >> y >> z >> c;
  int count = 0;
  if (x == y && x == z && x == c) {
    count = 3;
  } else if (x == y && x == z || x == y && x == c || y == z && y == c ||
             y == x && y == c || z == x && z == y || z == y && z == c ||
             x == c && y == z || x == z && y == c || x == y && z == c) {
    count = 2;
  } else if (x == y || x == z || x == c || y == z || y == c || z == c) {
    count++;
  }
  cout << count;
}
