import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();

		int pt = 0;
		int ph = 0;
		for (int i = 0; i < n; i++) {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		}
		System.out.printf(String.format("%d %d\n", pt, ph));
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();

		int pt = 0;
		int ph = 0;
		for (int i = 0; i < n; i++) {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		}
		System.out.printf(String.format("%d %d\n", pt, ph));
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();

		int pt = 0;
		int ph = 0;
		for (int i = 0; i < n; i++) {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		}
		System.out.printf(String.format("%d %d\n", pt, ph));
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();

		int pt = 0;
		int ph = 0;
		for (int i = 0; i < n; i++) {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		}
		System.out.printf(String.format("%d %d\n", pt, ph));
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in in.nextLine() in.nextLine in int pt = 0; pt 0 int ph = 0; ph 0 for (int i = 0; i < n; i++) {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		} {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		} String[] strs = in.nextLine().split(" "); strs in.nextLine().split(" ") in.nextLine().split in.nextLine() in.nextLine in " " String strTaro = strs[0]; strTaro strs[0] strs 0 String strHanako = strs[1]; strHanako strs[1] strs 1 int diff = strTaro.compareTo(strHanako); diff strTaro.compareTo(strHanako) strTaro.compareTo strTaro strHanako if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			} diff == 0 diff 0 {
				pt++;
				ph++;
			} pt++ pt ph++ ph if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			} diff > 0 diff 0 {
				// win taro
				pt += 3;
			} pt += 3 pt 3 {
				ph += 3;
			} ph += 3 ph 3 System.out.printf(String.format("%d %d\n", pt, ph)) System.out.printf System.out System System.out String.format("%d %d\n", pt, ph) String.format String "%d %d\n" pt ph String[] args args public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();

		int pt = 0;
		int ph = 0;
		for (int i = 0; i < n; i++) {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		}
		System.out.printf(String.format("%d %d\n", pt, ph));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();

		int pt = 0;
		int ph = 0;
		for (int i = 0; i < n; i++) {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		}
		System.out.printf(String.format("%d %d\n", pt, ph));
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();

		int pt = 0;
		int ph = 0;
		for (int i = 0; i < n; i++) {
			String[] strs = in.nextLine().split(" ");
			String strTaro = strs[0];
			String strHanako = strs[1];
			int diff = strTaro.compareTo(strHanako);
			if (diff == 0) {
				pt++;
				ph++;
			} else if (diff > 0) {
				// win taro
				pt += 3;
			} else {
				ph += 3;
			}
		}
		System.out.printf(String.format("%d %d\n", pt, ph));
	}
}