//CardGame
#include<iostream>
using namespace std;

int main()
{
	int n,t=0,h=0;
	cin >> n;
	string str1, str2;
	for(int i = 0; i < n; i++){
		cin >> str1 >> str2;
		if(str1 == str2){
			t += 1;
			h += 1;
		}else if(str1 < str2){
			h += 3;
		}else{
			t += 3;
		}
	}
	cout << t << " " << h << endl;
	return 0;
}
