import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int taroScore=0;
        int hanaScore=0;
        while(sc.hasNext()){
            String taro = sc.next();
            String hana = sc.next();
            int score = taro.compareTo(hana);  
            if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;}
        }
        System.out.println(taroScore +" "+ hanaScore);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int taroScore=0;
        int hanaScore=0;
        while(sc.hasNext()){
            String taro = sc.next();
            String hana = sc.next();
            int score = taro.compareTo(hana);  
            if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;}
        }
        System.out.println(taroScore +" "+ hanaScore);
    }
} Main public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int taroScore=0;
        int hanaScore=0;
        while(sc.hasNext()){
            String taro = sc.next();
            String hana = sc.next();
            int score = taro.compareTo(hana);  
            if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;}
        }
        System.out.println(taroScore +" "+ hanaScore);
    } main {
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int taroScore=0;
        int hanaScore=0;
        while(sc.hasNext()){
            String taro = sc.next();
            String hana = sc.next();
            int score = taro.compareTo(hana);  
            if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;}
        }
        System.out.println(taroScore +" "+ hanaScore);
    } Scanner sc= new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int taroScore=0; taroScore 0 int hanaScore=0; hanaScore 0 while(sc.hasNext()){
            String taro = sc.next();
            String hana = sc.next();
            int score = taro.compareTo(hana);  
            if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;}
        } sc.hasNext() sc.hasNext sc {
            String taro = sc.next();
            String hana = sc.next();
            int score = taro.compareTo(hana);  
            if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;}
        } String taro = sc.next(); taro sc.next() sc.next sc String hana = sc.next(); hana sc.next() sc.next sc int score = taro.compareTo(hana); score taro.compareTo(hana) taro.compareTo taro hana if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;} score < 0 score 0 hanaScore+=3 hanaScore 3 if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;} score > 0 score 0 taroScore+=3 taroScore 3 {  
                    hanaScore+=1;
                    taroScore+=1;} hanaScore+=1 hanaScore 1 taroScore+=1 taroScore 1 System.out.println(taroScore +" "+ hanaScore) System.out.println System.out System System.out taroScore +" "+ hanaScore taroScore +" "+ hanaScore taroScore " " hanaScore String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int taroScore=0;
        int hanaScore=0;
        while(sc.hasNext()){
            String taro = sc.next();
            String hana = sc.next();
            int score = taro.compareTo(hana);  
            if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;}
        }
        System.out.println(taroScore +" "+ hanaScore);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int taroScore=0;
        int hanaScore=0;
        while(sc.hasNext()){
            String taro = sc.next();
            String hana = sc.next();
            int score = taro.compareTo(hana);  
            if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;}
        }
        System.out.println(taroScore +" "+ hanaScore);
    }
} Main
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int taroScore=0;
        int hanaScore=0;
        while(sc.hasNext()){
            String taro = sc.next();
            String hana = sc.next();
            int score = taro.compareTo(hana);  
            if (score < 0)  
                hanaScore+=3;
            else if (score > 0) 
                    taroScore+=3;
                 else {  
                    hanaScore+=1;
                    taroScore+=1;}
        }
        System.out.println(taroScore +" "+ hanaScore);
    }
}
