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

class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int card = Integer.parseInt(br.readLine());
        String name;
        int t_point=0;
        int h_point=0;
        while ((name=br.readLine())!=null) {
        	if (card>1000 || name.length()>100) break;
            String[] c_name = name.split(" ");
            String tarou = c_name[0];
            String hanako = c_name[1];
            
            int judge = tarou.compareTo(hanako);
            
            if(judge<0){
                h_point += 3;
            }else if(judge>0){
                t_point += 3;
            }else{
                h_point += 1;
                t_point += 1;
            }
        }
        System.out.println(t_point+" "+h_point);
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int card = Integer.parseInt(br.readLine());
        String name;
        int t_point=0;
        int h_point=0;
        while ((name=br.readLine())!=null) {
        	if (card>1000 || name.length()>100) break;
            String[] c_name = name.split(" ");
            String tarou = c_name[0];
            String hanako = c_name[1];
            
            int judge = tarou.compareTo(hanako);
            
            if(judge<0){
                h_point += 3;
            }else if(judge>0){
                t_point += 3;
            }else{
                h_point += 1;
                t_point += 1;
            }
        }
        System.out.println(t_point+" "+h_point);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int card = Integer.parseInt(br.readLine());
        String name;
        int t_point=0;
        int h_point=0;
        while ((name=br.readLine())!=null) {
        	if (card>1000 || name.length()>100) break;
            String[] c_name = name.split(" ");
            String tarou = c_name[0];
            String hanako = c_name[1];
            
            int judge = tarou.compareTo(hanako);
            
            if(judge<0){
                h_point += 3;
            }else if(judge>0){
                t_point += 3;
            }else{
                h_point += 1;
                t_point += 1;
            }
        }
        System.out.println(t_point+" "+h_point);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int card = Integer.parseInt(br.readLine());
        String name;
        int t_point=0;
        int h_point=0;
        while ((name=br.readLine())!=null) {
        	if (card>1000 || name.length()>100) break;
            String[] c_name = name.split(" ");
            String tarou = c_name[0];
            String hanako = c_name[1];
            
            int judge = tarou.compareTo(hanako);
            
            if(judge<0){
                h_point += 3;
            }else if(judge>0){
                t_point += 3;
            }else{
                h_point += 1;
                t_point += 1;
            }
        }
        System.out.println(t_point+" "+h_point);
    } 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 String name; name int t_point=0; t_point 0 int h_point=0; h_point 0 while ((name=br.readLine())!=null) {
        	if (card>1000 || name.length()>100) break;
            String[] c_name = name.split(" ");
            String tarou = c_name[0];
            String hanako = c_name[1];
            
            int judge = tarou.compareTo(hanako);
            
            if(judge<0){
                h_point += 3;
            }else if(judge>0){
                t_point += 3;
            }else{
                h_point += 1;
                t_point += 1;
            }
        } (name=br.readLine())!=null (name=br.readLine()) name br.readLine() br.readLine br null {
        	if (card>1000 || name.length()>100) break;
            String[] c_name = name.split(" ");
            String tarou = c_name[0];
            String hanako = c_name[1];
            
            int judge = tarou.compareTo(hanako);
            
            if(judge<0){
                h_point += 3;
            }else if(judge>0){
                t_point += 3;
            }else{
                h_point += 1;
                t_point += 1;
            }
        } if (card>1000 || name.length()>100) break; card>1000 || name.length()>100 card>1000 card 1000 name.length()>100 name.length() name.length name 100 break; String[] c_name = name.split(" "); c_name name.split(" ") name.split name " " String tarou = c_name[0]; tarou c_name[0] c_name 0 String hanako = c_name[1]; hanako c_name[1] c_name 1 int judge = tarou.compareTo(hanako); judge tarou.compareTo(hanako) tarou.compareTo tarou hanako if(judge<0){
                h_point += 3;
            }else if(judge>0){
                t_point += 3;
            }else{
                h_point += 1;
                t_point += 1;
            } judge<0 judge 0 {
                h_point += 3;
            } h_point += 3 h_point 3 if(judge>0){
                t_point += 3;
            }else{
                h_point += 1;
                t_point += 1;
            } judge>0 judge 0 {
                t_point += 3;
            } t_point += 3 t_point 3 {
                h_point += 1;
                t_point += 1;
            } h_point += 1 h_point 1 t_point += 1 t_point 1 System.out.println(t_point+" "+h_point) System.out.println System.out System System.out t_point+" "+h_point t_point+" "+h_point t_point " " h_point String[] args args
import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int card = Integer.parseInt(br.readLine());
        String name;
        int t_point=0;
        int h_point=0;
        while ((name=br.readLine())!=null) {
        	if (card>1000 || name.length()>100) break;
            String[] c_name = name.split(" ");
            String tarou = c_name[0];
            String hanako = c_name[1];
            
            int judge = tarou.compareTo(hanako);
            
            if(judge<0){
                h_point += 3;
            }else if(judge>0){
                t_point += 3;
            }else{
                h_point += 1;
                t_point += 1;
            }
        }
        System.out.println(t_point+" "+h_point);
    }
}