import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int t_score = 0, h_score = 0;
        String t, h;
        int n = scanner.nextInt();
        for(int i = 0; i < n; i++){
            t = scanner.next();
            h = scanner.next();
            if(t.compareTo(h) > 0)t_score+=3;
            else if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            }
        }
        System.out.println(t_score + " " + h_score);


    }
}
 import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int t_score = 0, h_score = 0;
        String t, h;
        int n = scanner.nextInt();
        for(int i = 0; i < n; i++){
            t = scanner.next();
            h = scanner.next();
            if(t.compareTo(h) > 0)t_score+=3;
            else if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            }
        }
        System.out.println(t_score + " " + h_score);


    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int t_score = 0, h_score = 0;
        String t, h;
        int n = scanner.nextInt();
        for(int i = 0; i < n; i++){
            t = scanner.next();
            h = scanner.next();
            if(t.compareTo(h) > 0)t_score+=3;
            else if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            }
        }
        System.out.println(t_score + " " + h_score);


    } main {
        Scanner scanner = new Scanner(System.in);

        int t_score = 0, h_score = 0;
        String t, h;
        int n = scanner.nextInt();
        for(int i = 0; i < n; i++){
            t = scanner.next();
            h = scanner.next();
            if(t.compareTo(h) > 0)t_score+=3;
            else if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            }
        }
        System.out.println(t_score + " " + h_score);


    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int t_score = 0 t_score 0 h_score = 0; h_score 0 String t t h; h int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner for(int i = 0; i < n; i++){
            t = scanner.next();
            h = scanner.next();
            if(t.compareTo(h) > 0)t_score+=3;
            else if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            t = scanner.next();
            h = scanner.next();
            if(t.compareTo(h) > 0)t_score+=3;
            else if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            }
        } {
            t = scanner.next();
            h = scanner.next();
            if(t.compareTo(h) > 0)t_score+=3;
            else if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            }
        } t = scanner.next() t scanner.next() scanner.next scanner h = scanner.next() h scanner.next() scanner.next scanner if(t.compareTo(h) > 0)t_score+=3;
            else if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            } t.compareTo(h) > 0 t.compareTo(h) t.compareTo t h 0 t_score+=3 t_score 3 if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            } t.compareTo(h) < 0 t.compareTo(h) t.compareTo t h 0 h_score+=3 h_score 3 {
                t_score++;
                h_score++;
            } t_score++ t_score h_score++ h_score System.out.println(t_score + " " + h_score) System.out.println System.out System System.out t_score + " " + h_score t_score + " " + h_score t_score " " h_score String[] args args
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int t_score = 0, h_score = 0;
        String t, h;
        int n = scanner.nextInt();
        for(int i = 0; i < n; i++){
            t = scanner.next();
            h = scanner.next();
            if(t.compareTo(h) > 0)t_score+=3;
            else if(t.compareTo(h) < 0)h_score+=3;
            else {
                t_score++;
                h_score++;
            }
        }
        System.out.println(t_score + " " + h_score);


    }
}

