

import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		/*
		 * ?????????????????? [C/C++] ?????????????????? string ???????????°????¨????????????°???
		 * ???????????????????????°??????????????????????????? < ??? > ??¨
		 * ??????????????? == ????????¨???????????¨?????§????????????
		 *
		 * taro hanako
		 *
		 * card N; turn N; Win 3; Draw 1;
		 *
		 */

		Scanner sc = new Scanner(System.in);

		// declear variable
		int cardN; // same turn;
		int win = 3, draw = 1; // point
		String taro[], hanako[]; // player hands
		int pointT = 0, pointH = 0;// player`s point

		/*
		 * Sample Input 3
		 * cat dog
		 * fish fish
		 * lion tiger
		 * Sample Output 1 7
		 */

		// input Card N;
		cardN = sc.nextInt(); // ex : 3
		taro = new String[cardN];
		hanako = new String[cardN];

		// animal name
		for (int i = 0; i < cardN; i++) { // 3
			taro[i] = sc.next();
			hanako[i] = sc.next();

			int game = taro[i].compareToIgnoreCase(hanako[i]);
			if (game == 0) {
				pointT += draw;
				pointH += draw;
			} else if (game > 0) {
				pointT += win;
			} else {
				pointH += win;
			}
		}
		// output
		System.out.println(pointT + " " + pointH);
	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz