import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int card = Integer.parseInt(br.readLine());
		int turn = card;
		int win = 3;
		int drow = 1;
		int taropoint = 0;
		int hanakopoint = 0;

		for (int i = 0; i < turn; i++) {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		}
		System.out.println(taropoint + " " + hanakopoint);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int card = Integer.parseInt(br.readLine());
		int turn = card;
		int win = 3;
		int drow = 1;
		int taropoint = 0;
		int hanakopoint = 0;

		for (int i = 0; i < turn; i++) {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		}
		System.out.println(taropoint + " " + hanakopoint);
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int card = Integer.parseInt(br.readLine());
		int turn = card;
		int win = 3;
		int drow = 1;
		int taropoint = 0;
		int hanakopoint = 0;

		for (int i = 0; i < turn; i++) {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		}
		System.out.println(taropoint + " " + hanakopoint);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int card = Integer.parseInt(br.readLine());
		int turn = card;
		int win = 3;
		int drow = 1;
		int taropoint = 0;
		int hanakopoint = 0;

		for (int i = 0; i < turn; i++) {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		}
		System.out.println(taropoint + " " + hanakopoint);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int card = Integer.parseInt(br.readLine()); card Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int turn = card; turn card int win = 3; win 3 int drow = 1; drow 1 int taropoint = 0; taropoint 0 int hanakopoint = 0; hanakopoint 0 for (int i = 0; i < turn; i++) {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		} int i = 0; int i = 0; i 0 i < turn i turn i++ i++ i {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		} {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		} String str = null; str null str = br.readLine() str br.readLine() br.readLine br String[] s = str.split(" "); s str.split(" ") str.split str " " String taro = (s[0]); taro (s[0]) s 0 String hanako = (s[1]); hanako (s[1]) s 1 if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			} taro.compareTo(hanako) == 0 taro.compareTo(hanako) taro.compareTo taro hanako 0 {
				taropoint += drow;
				hanakopoint += drow;
			} taropoint += drow taropoint drow hanakopoint += drow hanakopoint drow if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			} taro.compareTo(hanako) < 0 taro.compareTo(hanako) taro.compareTo taro hanako 0 {
				hanakopoint += win;
			} hanakopoint += win hanakopoint win {
				taropoint += win;
			} taropoint += win taropoint win System.out.println(taropoint + " " + hanakopoint) System.out.println System.out System System.out taropoint + " " + hanakopoint taropoint + " " + hanakopoint taropoint " " hanakopoint String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int card = Integer.parseInt(br.readLine());
		int turn = card;
		int win = 3;
		int drow = 1;
		int taropoint = 0;
		int hanakopoint = 0;

		for (int i = 0; i < turn; i++) {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		}
		System.out.println(taropoint + " " + hanakopoint);
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int card = Integer.parseInt(br.readLine());
		int turn = card;
		int win = 3;
		int drow = 1;
		int taropoint = 0;
		int hanakopoint = 0;

		for (int i = 0; i < turn; i++) {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		}
		System.out.println(taropoint + " " + hanakopoint);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int card = Integer.parseInt(br.readLine());
		int turn = card;
		int win = 3;
		int drow = 1;
		int taropoint = 0;
		int hanakopoint = 0;

		for (int i = 0; i < turn; i++) {
			String str = null;
			str = br.readLine();
			String[] s = str.split(" ");
			String taro = (s[0]);
			String hanako = (s[1]);

			if(taro.compareTo(hanako) == 0){
				taropoint += drow;
				hanakopoint += drow;
			}else if(taro.compareTo(hanako) < 0){
				hanakopoint += win;
			}else{
				taropoint += win;
			}
		}
		System.out.println(taropoint + " " + hanakopoint);
	}
}