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);
	}

}
 import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.io.*; io.* java 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);
	}

} 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);
	} main {
		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);
	} int pA = 0 pA 0 pB = 0; pB 0 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = Integer.parseInt(scan.nextLine()); num Integer.parseInt(scan.nextLine()) Integer.parseInt Integer scan.nextLine() scan.nextLine scan int cnt = 0; 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++;
			}
		} cnt < num 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++;
			}
		} String tmp = scan.nextLine(); tmp scan.nextLine() scan.nextLine scan String a = tmp.split(" ")[0]; a tmp.split(" ")[0] tmp.split(" ") tmp.split tmp " " 0 String b = tmp.split(" ")[1]; b tmp.split(" ")[1] tmp.split(" ") tmp.split tmp " " 1 int turncnt = 0; turncnt 0 cnt++ cnt if(a.equals(b)){
				pA++;
				pB++;
				continue;
			} a.equals(b) a.equals a b {
				pA++;
				pB++;
				continue;
			} pA++ pA pB++ 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++;
			} 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++;
			} char[] cA = a.toCharArray(); cA a.toCharArray() a.toCharArray a char[] cB = b.toCharArray(); cB b.toCharArray() b.toCharArray b if (turncnt == a.length() || turncnt == b.length()) {
					if(cA.length > cB.length){
						pA += 3;
					}else if(cA.length < cB.length){
						pB += 3;
					}
					break;
				} turncnt == a.length() || turncnt == b.length() turncnt == a.length() turncnt a.length() a.length a turncnt == b.length() turncnt b.length() b.length b {
					if(cA.length > cB.length){
						pA += 3;
					}else if(cA.length < cB.length){
						pB += 3;
					}
					break;
				} if(cA.length > cB.length){
						pA += 3;
					}else if(cA.length < cB.length){
						pB += 3;
					} cA.length > cB.length cA.length cA cA.length cB.length cB cB.length {
						pA += 3;
					} pA += 3 pA 3 if(cA.length < cB.length){
						pB += 3;
					} cA.length < cB.length cA.length cA cA.length cB.length cB cB.length {
						pB += 3;
					} pB += 3 pB 3 break; if (cA[turncnt] > cB[turncnt]) {
					pA += 3;
					break;
				} else if (cA[turncnt] < cB[turncnt]) {
					pB += 3;
					break;
				} cA[turncnt] > cB[turncnt] cA[turncnt] cA turncnt cB[turncnt] cB turncnt {
					pA += 3;
					break;
				} pA += 3 pA 3 break; if (cA[turncnt] < cB[turncnt]) {
					pB += 3;
					break;
				} cA[turncnt] < cB[turncnt] cA[turncnt] cA turncnt cB[turncnt] cB turncnt {
					pB += 3;
					break;
				} pB += 3 pB 3 break; turncnt++ turncnt System.out.println(pA + " " + pB) System.out.println System.out System System.out pA + " " + pB pA + " " + pB pA " " pB String[] args args 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);
	}

} 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);
	}

} Main
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);
	}

}

