import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int point[] = new int[2];
		for (int i = 0; i < n; i++) {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		}
		System.out.println(String.format("%d %d", point[0], point[1]));
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int point[] = new int[2];
		for (int i = 0; i < n; i++) {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		}
		System.out.println(String.format("%d %d", point[0], point[1]));
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int point[] = new int[2];
		for (int i = 0; i < n; i++) {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		}
		System.out.println(String.format("%d %d", point[0], point[1]));
	} main {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int point[] = new int[2];
		for (int i = 0; i < n; i++) {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		}
		System.out.println(String.format("%d %d", point[0], point[1]));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int point[] = new int[2]; point new int[2] 2 for (int i = 0; i < n; i++) {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		} {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		} String game = sc.nextLine(); game sc.nextLine() sc.nextLine sc String games[] = game.split(" "); games game.split(" ") game.split game " " if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			} games[0].compareTo(games[1]) == 0 games[0].compareTo(games[1]) games[0].compareTo games[0] games 0 games[1] games 1 0 {
				point[0]++;
				point[1]++;
			} point[0]++ point[0] point 0 point[1]++ point[1] point 1 if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			} games[0].compareTo(games[1]) > 0 games[0].compareTo(games[1]) games[0].compareTo games[0] games 0 games[1] games 1 0 {
				point[0] += 3;
			} point[0] += 3 point[0] point 0 3 {
				point[1] += 3;
			} point[1] += 3 point[1] point 1 3 System.out.println(String.format("%d %d", point[0], point[1])) System.out.println System.out System System.out String.format("%d %d", point[0], point[1]) String.format String "%d %d" point[0] point 0 point[1] point 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int point[] = new int[2];
		for (int i = 0; i < n; i++) {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		}
		System.out.println(String.format("%d %d", point[0], point[1]));
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int point[] = new int[2];
		for (int i = 0; i < n; i++) {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		}
		System.out.println(String.format("%d %d", point[0], point[1]));
	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int point[] = new int[2];
		for (int i = 0; i < n; i++) {
			String game = sc.nextLine();
			String games[] = game.split(" ");
			if (games[0].compareTo(games[1]) == 0) {
				point[0]++;
				point[1]++;
			} else if (games[0].compareTo(games[1]) > 0) {
				point[0] += 3;
			} else {
				point[1] += 3;
			}
		}
		System.out.println(String.format("%d %d", point[0], point[1]));
	}

}