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

public class Main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int taro_point = 0, hana_point = 0;
        for(int i = 0; i < n ; i++){
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        }

        System.out.printf("%d %d\n", taro_point, hana_point);
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int taro_point = 0, hana_point = 0;
        for(int i = 0; i < n ; i++){
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        }

        System.out.printf("%d %d\n", taro_point, hana_point);
    }
} Main public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int taro_point = 0, hana_point = 0;
        for(int i = 0; i < n ; i++){
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        }

        System.out.printf("%d %d\n", taro_point, hana_point);
    } main {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int taro_point = 0, hana_point = 0;
        for(int i = 0; i < n ; i++){
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        }

        System.out.printf("%d %d\n", taro_point, hana_point);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int taro_point = 0 taro_point 0 hana_point = 0; hana_point 0 for(int i = 0; i < n ; i++){
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        } {
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        } int compared = in.next().compareTo(in.next()); compared in.next().compareTo(in.next()) in.next().compareTo in.next() in.next in in.next() in.next in if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3; compared == 0 compared 0 {
                taro_point++;
                hana_point++;
            } taro_point++ taro_point hana_point++ hana_point if(compared > 0) taro_point += 3;
            else hana_point += 3; compared > 0 compared 0 taro_point += 3 taro_point 3 hana_point += 3 hana_point 3 System.out.printf("%d %d\n", taro_point, hana_point) System.out.printf System.out System System.out "%d %d\n" taro_point hana_point String args[] args public class Main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int taro_point = 0, hana_point = 0;
        for(int i = 0; i < n ; i++){
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        }

        System.out.printf("%d %d\n", taro_point, hana_point);
    }
} public class Main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int taro_point = 0, hana_point = 0;
        for(int i = 0; i < n ; i++){
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        }

        System.out.printf("%d %d\n", taro_point, hana_point);
    }
} Main
import java.util.*;
import java.io.*;

public class Main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int taro_point = 0, hana_point = 0;
        for(int i = 0; i < n ; i++){
            int compared = in.next().compareTo(in.next());

            if(compared == 0){
                taro_point++;
                hana_point++;
            }
            else if(compared > 0) taro_point += 3;
            else hana_point += 3;
        }

        System.out.printf("%d %d\n", taro_point, hana_point);
    }
}
