import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int n = Integer.parseInt(sc.next());
		int taroScore = 0, hanakoScore = 0;
		for (int i=0; i < n; i++) {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		}
		sc.close(); System.out.println(taroScore + " " + hanakoScore);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int n = Integer.parseInt(sc.next());
		int taroScore = 0, hanakoScore = 0;
		for (int i=0; i < n; i++) {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		}
		sc.close(); System.out.println(taroScore + " " + hanakoScore);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int n = Integer.parseInt(sc.next());
		int taroScore = 0, hanakoScore = 0;
		for (int i=0; i < n; i++) {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		}
		sc.close(); System.out.println(taroScore + " " + hanakoScore);
	} main {
		Scanner sc = new Scanner(System.in);
		final int n = Integer.parseInt(sc.next());
		int taroScore = 0, hanakoScore = 0;
		for (int i=0; i < n; i++) {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		}
		sc.close(); System.out.println(taroScore + " " + hanakoScore);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int taroScore = 0 taroScore 0 hanakoScore = 0; hanakoScore 0 for (int i=0; i < n; i++) {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		} int i=0; int i=0; i 0 i < n i n i++ i++ i {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		} {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		} String taro = sc.next() taro sc.next() sc.next sc hanako = sc.next(); hanako sc.next() sc.next sc if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; } taro.compareToIgnoreCase(hanako) < 0 taro.compareToIgnoreCase(hanako) taro.compareToIgnoreCase taro hanako 0 hanakoScore += 3 hanakoScore 3 if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; } taro.compareToIgnoreCase(hanako) > 0 taro.compareToIgnoreCase(hanako) taro.compareToIgnoreCase taro hanako 0 taroScore += 3 taroScore 3 { taroScore++; hanakoScore++; } taroScore++ taroScore hanakoScore++ hanakoScore sc.close() sc.close sc System.out.println(taroScore + " " + hanakoScore) System.out.println System.out System System.out taroScore + " " + hanakoScore taroScore + " " + hanakoScore taroScore " " hanakoScore String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int n = Integer.parseInt(sc.next());
		int taroScore = 0, hanakoScore = 0;
		for (int i=0; i < n; i++) {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		}
		sc.close(); System.out.println(taroScore + " " + hanakoScore);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int n = Integer.parseInt(sc.next());
		int taroScore = 0, hanakoScore = 0;
		for (int i=0; i < n; i++) {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		}
		sc.close(); System.out.println(taroScore + " " + hanakoScore);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int n = Integer.parseInt(sc.next());
		int taroScore = 0, hanakoScore = 0;
		for (int i=0; i < n; i++) {
			String taro = sc.next(), hanako = sc.next();
			if (taro.compareToIgnoreCase(hanako) < 0) hanakoScore += 3;
			else if (taro.compareToIgnoreCase(hanako) > 0) taroScore += 3;
			else { taroScore++; hanakoScore++; }
		}
		sc.close(); System.out.println(taroScore + " " + hanakoScore);
	}
}