#include <iostream>
#include <string>
using namespace std;
int main(){
	int n; cin >> n ;
	int scoreA=0 ; int scoreB=0 ;
	for(int i=0;i<n;i++){
		int base=0; int out=0;string str; int score=0;
		while(1){
		cin >> str ;
		if(str=="OUT") out++;
		else if(str=="HIT") base++;
		else if(str=="HOMERUN") do{score+=++base; base=0;}while(0);
		if(out>=3) break;
		if(base>=4) do{base=3;score++;}while(0);
		};
		if(i%2==0) scoreA+=score; else scoreB+=score;
	};
	cout << scoreA << '\n' << scoreB << '\n' ;
}