import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int tarou=0,hanako=0;
        int r;
        for(int i=0;i<n;i++){
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        }
        System.out.printf("%d %d\n",tarou,hanako);
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int tarou=0,hanako=0;
        int r;
        for(int i=0;i<n;i++){
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        }
        System.out.printf("%d %d\n",tarou,hanako);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int tarou=0,hanako=0;
        int r;
        for(int i=0;i<n;i++){
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        }
        System.out.printf("%d %d\n",tarou,hanako);
    } main {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int tarou=0,hanako=0;
        int r;
        for(int i=0;i<n;i++){
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        }
        System.out.printf("%d %d\n",tarou,hanako);
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int tarou=0 tarou 0 hanako=0; hanako 0 int r; r for(int i=0;i<n;i++){
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        } {
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        } r=sc.next().compareToIgnoreCase(sc.next()) r sc.next().compareToIgnoreCase(sc.next()) sc.next().compareToIgnoreCase sc.next() sc.next sc sc.next() sc.next sc if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3; r<0 r 0 hanako+=3 hanako 3 if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3; r==0 r 0 {
                tarou++;
                hanako++;
            } tarou++ tarou hanako++ hanako tarou+=3 tarou 3 System.out.printf("%d %d\n",tarou,hanako) System.out.printf System.out System System.out "%d %d\n" tarou hanako String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int tarou=0,hanako=0;
        int r;
        for(int i=0;i<n;i++){
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        }
        System.out.printf("%d %d\n",tarou,hanako);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int tarou=0,hanako=0;
        int r;
        for(int i=0;i<n;i++){
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        }
        System.out.printf("%d %d\n",tarou,hanako);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int tarou=0,hanako=0;
        int r;
        for(int i=0;i<n;i++){
            r=sc.next().compareToIgnoreCase(sc.next());
            if(r<0)hanako+=3;
            else if(r==0){
                tarou++;
                hanako++;
            }else tarou+=3;
        }
        System.out.printf("%d %d\n",tarou,hanako);
    }
}

