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