#include <bits/stdc++.h>
int main(void) {
  int x[4], i, j, temp, c1, c2;
  c1 = 0;
  c2 = 0;
  while (scanf("%d,%d,%d", &x[0], &x[1], &x[2]) != EOF) {
    for (i = 0; i < 2; i++) {
      for (j = i + 1; j <= 2; j++) {
        if (x[i] < x[j]) {
          temp = x[i];
          x[i] = x[j];
          x[j] = temp;
        }
      }
    }
    if (x[0] == 5 && (x[1] == 3 && x[2] == 4) || (x[1] == 4 && x[2] == 3)) {
      c1++;
    }
    if (x[0] == 8 && x[1] == 5 && x[2] == 5) {
      c2++;
    }
  }
  printf("%d\n%d\n", c1, c2);
  return 0;
}
