import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int score_t = 0;
		int score_h = 0;
		while (n-- > 0) {
			String word_t = sc.next();
			String word_h = sc.next();

			int result = word_t.compareTo(word_h);
			if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			}
		}

	    System.out.println(score_t + " " + score_h);
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int score_t = 0;
		int score_h = 0;
		while (n-- > 0) {
			String word_t = sc.next();
			String word_h = sc.next();

			int result = word_t.compareTo(word_h);
			if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			}
		}

	    System.out.println(score_t + " " + score_h);
	}
} Main public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int score_t = 0;
		int score_h = 0;
		while (n-- > 0) {
			String word_t = sc.next();
			String word_h = sc.next();

			int result = word_t.compareTo(word_h);
			if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			}
		}

	    System.out.println(score_t + " " + score_h);
	} main {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int score_t = 0;
		int score_h = 0;
		while (n-- > 0) {
			String word_t = sc.next();
			String word_h = sc.next();

			int result = word_t.compareTo(word_h);
			if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			}
		}

	    System.out.println(score_t + " " + score_h);
	} @SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int score_t = 0; score_t 0 int score_h = 0; score_h 0 while (n-- > 0) {
			String word_t = sc.next();
			String word_h = sc.next();

			int result = word_t.compareTo(word_h);
			if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			}
		} n-- > 0 n-- n 0 {
			String word_t = sc.next();
			String word_h = sc.next();

			int result = word_t.compareTo(word_h);
			if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			}
		} String word_t = sc.next(); word_t sc.next() sc.next sc String word_h = sc.next(); word_h sc.next() sc.next sc int result = word_t.compareTo(word_h); result word_t.compareTo(word_h) word_t.compareTo word_t word_h if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			} result == 0 result 0 {
				score_t += 1;
				score_h += 1;
			} score_t += 1 score_t 1 score_h += 1 score_h 1 if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			} result > 0 result 0 {
				score_t += 3;
			} score_t += 3 score_t 3 {
				score_h += 3;
			} score_h += 3 score_h 3 System.out.println(score_t + " " + score_h) System.out.println System.out System System.out score_t + " " + score_h score_t + " " + score_h score_t " " score_h String[] args args public class Main{
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int score_t = 0;
		int score_h = 0;
		while (n-- > 0) {
			String word_t = sc.next();
			String word_h = sc.next();

			int result = word_t.compareTo(word_h);
			if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			}
		}

	    System.out.println(score_t + " " + score_h);
	}
} public class Main{
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int score_t = 0;
		int score_h = 0;
		while (n-- > 0) {
			String word_t = sc.next();
			String word_h = sc.next();

			int result = word_t.compareTo(word_h);
			if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			}
		}

	    System.out.println(score_t + " " + score_h);
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		int score_t = 0;
		int score_h = 0;
		while (n-- > 0) {
			String word_t = sc.next();
			String word_h = sc.next();

			int result = word_t.compareTo(word_h);
			if (result == 0) {
				score_t += 1;
				score_h += 1;
			} else if (result > 0) {
				score_t += 3;
			} else {
				score_h += 3;
			}
		}

	    System.out.println(score_t + " " + score_h);
	}
}