import java.io.*;
import java.util.*;

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

                    int taro =0;
                    int hana =0;
                    String[] temp = new String[2];

                    while((str = br.readLine()) != null){
                        int n = Integer.parseInt(str);
                        for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        }
                    }

                    System.out.println(taro + " " + hana);

    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

                    int taro =0;
                    int hana =0;
                    String[] temp = new String[2];

                    while((str = br.readLine()) != null){
                        int n = Integer.parseInt(str);
                        for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        }
                    }

                    System.out.println(taro + " " + hana);

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

                    int taro =0;
                    int hana =0;
                    String[] temp = new String[2];

                    while((str = br.readLine()) != null){
                        int n = Integer.parseInt(str);
                        for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        }
                    }

                    System.out.println(taro + " " + hana);

    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

                    int taro =0;
                    int hana =0;
                    String[] temp = new String[2];

                    while((str = br.readLine()) != null){
                        int n = Integer.parseInt(str);
                        for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        }
                    }

                    System.out.println(taro + " " + hana);

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str; str int taro =0; taro 0 int hana =0; hana 0 String[] temp = new String[2]; temp new String[2] 2 while((str = br.readLine()) != null){
                        int n = Integer.parseInt(str);
                        for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        }
                    } (str = br.readLine()) != null (str = br.readLine()) str br.readLine() br.readLine br null {
                        int n = Integer.parseInt(str);
                        for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        }
                    } int n = Integer.parseInt(str); n Integer.parseInt(str) Integer.parseInt Integer str for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        } {
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        } str = br.readLine() str br.readLine() br.readLine br temp = str.split("\\s") temp str.split("\\s") str.split str "\\s" if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            } temp[0].compareTo(temp[1]) == 0 temp[0].compareTo(temp[1]) temp[0].compareTo temp[0] temp 0 temp[1] temp 1 0 {
                                taro++;
                                hana++;
                            } taro++ taro hana++ hana if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            } temp[0].compareTo(temp[1]) > 0 temp[0].compareTo(temp[1]) temp[0].compareTo temp[0] temp 0 temp[1] temp 1 0 {
                                taro +=3;
                            } taro +=3 taro 3 {
                                hana +=3;
                            } hana +=3 hana 3 System.out.println(taro + " " + hana) System.out.println System.out System System.out taro + " " + hana taro + " " + hana taro " " hana String[] args args public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

                    int taro =0;
                    int hana =0;
                    String[] temp = new String[2];

                    while((str = br.readLine()) != null){
                        int n = Integer.parseInt(str);
                        for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        }
                    }

                    System.out.println(taro + " " + hana);

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

                    int taro =0;
                    int hana =0;
                    String[] temp = new String[2];

                    while((str = br.readLine()) != null){
                        int n = Integer.parseInt(str);
                        for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        }
                    }

                    System.out.println(taro + " " + hana);

    }
} Main
import java.io.*;
import java.util.*;

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

                    int taro =0;
                    int hana =0;
                    String[] temp = new String[2];

                    while((str = br.readLine()) != null){
                        int n = Integer.parseInt(str);
                        for(int i=0;i<n;i++){
                            str = br.readLine();
                            temp = str.split("\\s");
                            
                            if(temp[0].compareTo(temp[1]) == 0){
                                taro++;
                                hana++;
                            }else if(temp[0].compareTo(temp[1]) > 0){
                                taro +=3;
                            }else{
                                hana +=3;
                            }
                        }
                    }

                    System.out.println(taro + " " + hana);

    }
}