import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt(), tapo=0, hapo=0;
        for (int i=0; i<n; i++){
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        }
        System.out.println(tapo+" "+hapo);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt(), tapo=0, hapo=0;
        for (int i=0; i<n; i++){
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        }
        System.out.println(tapo+" "+hapo);
    }
} Main public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt(), tapo=0, hapo=0;
        for (int i=0; i<n; i++){
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        }
        System.out.println(tapo+" "+hapo);
    } main {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt(), tapo=0, hapo=0;
        for (int i=0; i<n; i++){
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        }
        System.out.println(tapo+" "+hapo);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt() n s.nextInt() s.nextInt s tapo=0 tapo 0 hapo=0; hapo 0 for (int i=0; i<n; i++){
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        } {
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        } String taro = s.next(); taro s.next() s.next s String hana = s.next(); hana s.next() s.next s int co=taro.compareTo(hana); co taro.compareTo(hana) taro.compareTo taro hana if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            } co>0 co 0 tapo += 3 tapo 3 if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            } co<0 co 0 hapo += 3 hapo 3 {
                tapo++;
                hapo++;
            } tapo++ tapo hapo++ hapo System.out.println(tapo+" "+hapo) System.out.println System.out System System.out tapo+" "+hapo tapo+" "+hapo tapo " " hapo String[] args args public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt(), tapo=0, hapo=0;
        for (int i=0; i<n; i++){
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        }
        System.out.println(tapo+" "+hapo);
    }
} public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt(), tapo=0, hapo=0;
        for (int i=0; i<n; i++){
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        }
        System.out.println(tapo+" "+hapo);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt(), tapo=0, hapo=0;
        for (int i=0; i<n; i++){
            String taro = s.next();
            String hana = s.next();
            int co=taro.compareTo(hana);
            if (co>0) tapo += 3;
            else if (co<0) hapo += 3;
            else{
                tapo++;
                hapo++;
            }
        }
        System.out.println(tapo+" "+hapo);
    }
}
