import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int n = Integer.parseInt(line);

	    int tarouScore = 0;
	    int hanakoScore = 0;
	    for (int i = 0; i < n; i++) {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    }
	    System.out.println(tarouScore + " " + hanakoScore);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int n = Integer.parseInt(line);

	    int tarouScore = 0;
	    int hanakoScore = 0;
	    for (int i = 0; i < n; i++) {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    }
	    System.out.println(tarouScore + " " + hanakoScore);
	}
} Main public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int n = Integer.parseInt(line);

	    int tarouScore = 0;
	    int hanakoScore = 0;
	    for (int i = 0; i < n; i++) {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    }
	    System.out.println(tarouScore + " " + hanakoScore);
	} main {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int n = Integer.parseInt(line);

	    int tarouScore = 0;
	    int hanakoScore = 0;
	    for (int i = 0; i < n; i++) {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    }
	    System.out.println(tarouScore + " " + hanakoScore);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line = br.readLine(); line br.readLine() br.readLine br int n = Integer.parseInt(line); n Integer.parseInt(line) Integer.parseInt Integer line int tarouScore = 0; tarouScore 0 int hanakoScore = 0; hanakoScore 0 for (int i = 0; i < n; i++) {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    } {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    } String[]s = br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String tarou = s[0]; tarou s[0] s 0 String hanako = s[1]; hanako s[1] s 1 ArrayList<String> dic = new ArrayList<String>(); dic new ArrayList<String>() dic.add(tarou) dic.add dic tarou dic.add(hanako) dic.add dic hanako Collections.sort(dic) Collections.sort Collections dic if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			} tarou.equals(hanako) tarou.equals tarou hanako {
				tarouScore += 1;
				hanakoScore += 1;
			} tarouScore += 1 tarouScore 1 hanakoScore += 1 hanakoScore 1 if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			} tarou.equals(dic.get(0)) tarou.equals tarou dic.get(0) dic.get dic 0 {
				hanakoScore += 3;
			} hanakoScore += 3 hanakoScore 3 {
				tarouScore += 3;
			} tarouScore += 3 tarouScore 3 System.out.println(tarouScore + " " + hanakoScore) System.out.println System.out System System.out tarouScore + " " + hanakoScore tarouScore + " " + hanakoScore tarouScore " " hanakoScore String[] args args public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int n = Integer.parseInt(line);

	    int tarouScore = 0;
	    int hanakoScore = 0;
	    for (int i = 0; i < n; i++) {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    }
	    System.out.println(tarouScore + " " + hanakoScore);
	}
} public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int n = Integer.parseInt(line);

	    int tarouScore = 0;
	    int hanakoScore = 0;
	    for (int i = 0; i < n; i++) {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    }
	    System.out.println(tarouScore + " " + hanakoScore);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int n = Integer.parseInt(line);

	    int tarouScore = 0;
	    int hanakoScore = 0;
	    for (int i = 0; i < n; i++) {
	    	String[]s = br.readLine().split(" ");
			String tarou = s[0];
			String hanako = s[1];

			ArrayList<String> dic = new ArrayList<String>();
			dic.add(tarou);
			dic.add(hanako);

			Collections.sort(dic);

			if (tarou.equals(hanako)) {
				tarouScore += 1;
				hanakoScore += 1;
			} else if (tarou.equals(dic.get(0))) {
				hanakoScore += 3;
			} else {
				tarouScore += 3;
			}
	    }
	    System.out.println(tarouScore + " " + hanakoScore);
	}
}