import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner scan = new Scanner(System.in);
		int n, temp, tarosP = 0, hanakosP = 0;
		String taro, hanako;
		
		// input
		n = scan.nextInt();
		
		// loop
		for (int i = 0; i < n; i++) {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		}
		
		// output
		System.out.println(tarosP + " " + hanakosP);
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner scan = new Scanner(System.in);
		int n, temp, tarosP = 0, hanakosP = 0;
		String taro, hanako;
		
		// input
		n = scan.nextInt();
		
		// loop
		for (int i = 0; i < n; i++) {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		}
		
		// output
		System.out.println(tarosP + " " + hanakosP);
	}
} Main public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args void run() {
		Scanner scan = new Scanner(System.in);
		int n, temp, tarosP = 0, hanakosP = 0;
		String taro, hanako;
		
		// input
		n = scan.nextInt();
		
		// loop
		for (int i = 0; i < n; i++) {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		}
		
		// output
		System.out.println(tarosP + " " + hanakosP);
	} run {
		Scanner scan = new Scanner(System.in);
		int n, temp, tarosP = 0, hanakosP = 0;
		String taro, hanako;
		
		// input
		n = scan.nextInt();
		
		// loop
		for (int i = 0; i < n; i++) {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		}
		
		// output
		System.out.println(tarosP + " " + hanakosP);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n n temp temp tarosP = 0 tarosP 0 hanakosP = 0; hanakosP 0 String taro taro hanako; hanako n = scan.nextInt() n scan.nextInt() scan.nextInt scan for (int i = 0; i < n; i++) {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		} {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		} taro = scan.next() taro scan.next() scan.next scan hanako = scan.next() hanako scan.next() scan.next scan temp = taro.compareTo(hanako) temp taro.compareTo(hanako) taro.compareTo taro hanako if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			} temp > 0 temp 0 tarosP += 3 tarosP 3 if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			} temp < 0 temp 0 hanakosP += 3 hanakosP 3 {
				tarosP++; hanakosP++;
			} tarosP++ tarosP hanakosP++ hanakosP System.out.println(tarosP + " " + hanakosP) System.out.println System.out System System.out tarosP + " " + hanakosP tarosP + " " + hanakosP tarosP " " hanakosP public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner scan = new Scanner(System.in);
		int n, temp, tarosP = 0, hanakosP = 0;
		String taro, hanako;
		
		// input
		n = scan.nextInt();
		
		// loop
		for (int i = 0; i < n; i++) {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		}
		
		// output
		System.out.println(tarosP + " " + hanakosP);
	}
} public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner scan = new Scanner(System.in);
		int n, temp, tarosP = 0, hanakosP = 0;
		String taro, hanako;
		
		// input
		n = scan.nextInt();
		
		// loop
		for (int i = 0; i < n; i++) {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		}
		
		// output
		System.out.println(tarosP + " " + hanakosP);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner scan = new Scanner(System.in);
		int n, temp, tarosP = 0, hanakosP = 0;
		String taro, hanako;
		
		// input
		n = scan.nextInt();
		
		// loop
		for (int i = 0; i < n; i++) {
			taro = scan.next(); hanako = scan.next();
			temp = taro.compareTo(hanako);
			if (temp > 0) tarosP += 3;
			else if (temp < 0) hanakosP += 3;
			else {
				tarosP++; hanakosP++;
			}
		}
		
		// output
		System.out.println(tarosP + " " + hanakosP);
	}
}

