#include<iostream>
#include<deque>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(void){
	deque<int> in;
	int a,b,c;
	int tyou=0,hisi=0;
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
		if(in.empty()==false)
			in.clear();
		in.push_back(a);
		in.push_back(b);
		in.push_back(c);
		sort(in.begin(),in.end());
		//cout<<in[0]<<in[1]<<in[2]<<endl;
		if(in[0]==3 &&in[1]==4&&in[2]==5)
			tyou++;
		if(in[0]==5 &&in[1]==5&&in[2]==8)
			hisi++;
	}
	cout<<tyou<<endl<<hisi<<endl;

	return 0;
}