import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		int pA = 0, pB = 0;

		Scanner scan = new Scanner(System.in);
		int num = Integer.parseInt(scan.nextLine());
		int cnt = 0;
		while (cnt < num) {
			String tmp = scan.nextLine();
			String a = tmp.split(" ")[0];
			String b = tmp.split(" ")[1];
			int turncnt = 0;
			cnt++;
			if(a.equals(b)){
				pA++;
				pB++;
				continue;
			}
			while (true) {
				char[] cA = a.toCharArray();
				char[] cB = b.toCharArray();

				if (turncnt == a.length() || turncnt == b.length()) {
					if(cA.length > cB.length){
						pA += 3;
					}else if(cA.length < cB.length){
						pB += 3;
					}
					break;
				}

				if (cA[turncnt] > cB[turncnt]) {
					pA += 3;
					break;
				} else if (cA[turncnt] < cB[turncnt]) {
					pB += 3;
					break;
				}
				turncnt++;
			}
		}
		System.out.println(pA + " " + pB);
	}

}


/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