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[] str;
        int t=0;
        int h=0;
        for(int i=0; i<card; i++){
          
            str = br.readLine().split(" ");  
            String tarou = str[0];
            String hanako = str[1];

            int judge = tarou.compareTo(hanako);
             
            if(judge<0){        
                h += 3;   
            }else if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            }
        }
        System.out.println(t +" "+h);
    }
} 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[] str;
        int t=0;
        int h=0;
        for(int i=0; i<card; i++){
          
            str = br.readLine().split(" ");  
            String tarou = str[0];
            String hanako = str[1];

            int judge = tarou.compareTo(hanako);
             
            if(judge<0){        
                h += 3;   
            }else if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            }
        }
        System.out.println(t +" "+h);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int card = Integer.parseInt(br.readLine());    
        String[] str;
        int t=0;
        int h=0;
        for(int i=0; i<card; i++){
          
            str = br.readLine().split(" ");  
            String tarou = str[0];
            String hanako = str[1];

            int judge = tarou.compareTo(hanako);
             
            if(judge<0){        
                h += 3;   
            }else if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            }
        }
        System.out.println(t +" "+h);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int card = Integer.parseInt(br.readLine());    
        String[] str;
        int t=0;
        int h=0;
        for(int i=0; i<card; i++){
          
            str = br.readLine().split(" ");  
            String tarou = str[0];
            String hanako = str[1];

            int judge = tarou.compareTo(hanako);
             
            if(judge<0){        
                h += 3;   
            }else if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            }
        }
        System.out.println(t +" "+h);
    } 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[] str; str int t=0; t 0 int h=0; h 0 for(int i=0; i<card; i++){
          
            str = br.readLine().split(" ");  
            String tarou = str[0];
            String hanako = str[1];

            int judge = tarou.compareTo(hanako);
             
            if(judge<0){        
                h += 3;   
            }else if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            }
        } int i=0; int i=0; i 0 i<card i card i++ i++ i {
          
            str = br.readLine().split(" ");  
            String tarou = str[0];
            String hanako = str[1];

            int judge = tarou.compareTo(hanako);
             
            if(judge<0){        
                h += 3;   
            }else if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            }
        } {
          
            str = br.readLine().split(" ");  
            String tarou = str[0];
            String hanako = str[1];

            int judge = tarou.compareTo(hanako);
             
            if(judge<0){        
                h += 3;   
            }else if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            }
        } str = br.readLine().split(" ") str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String tarou = str[0]; tarou str[0] str 0 String hanako = str[1]; hanako str[1] str 1 int judge = tarou.compareTo(hanako); judge tarou.compareTo(hanako) tarou.compareTo tarou hanako if(judge<0){        
                h += 3;   
            }else if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            } judge<0 judge 0 {        
                h += 3;   
            } h += 3 h 3 if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            } judge>0 judge 0 {  
                t += 3;   
            } t += 3 t 3 {              
                h += 1;   
                t += 1;
            } h += 1 h 1 t += 1 t 1 System.out.println(t +" "+h) System.out.println System.out System System.out t +" "+h t +" "+h t " " h 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[] str;
        int t=0;
        int h=0;
        for(int i=0; i<card; i++){
          
            str = br.readLine().split(" ");  
            String tarou = str[0];
            String hanako = str[1];

            int judge = tarou.compareTo(hanako);
             
            if(judge<0){        
                h += 3;   
            }else if(judge>0){  
                t += 3;   
            }else{              
                h += 1;   
                t += 1;
            }
        }
        System.out.println(t +" "+h);
    }
}