import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),t = 0,h = 0;
        for(int i = 0;i < n;++i){
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        }
        System.out.printf("%d %d\n",t,h);
    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),t = 0,h = 0;
        for(int i = 0;i < n;++i){
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        }
        System.out.printf("%d %d\n",t,h);
    }

} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),t = 0,h = 0;
        for(int i = 0;i < n;++i){
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        }
        System.out.printf("%d %d\n",t,h);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),t = 0,h = 0;
        for(int i = 0;i < n;++i){
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        }
        System.out.printf("%d %d\n",t,h);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt() n sc.nextInt() sc.nextInt sc t = 0 t 0 h = 0; h 0 for(int i = 0;i < n;++i){
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        } int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        } {
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        } String a = sc.next() a sc.next() sc.next sc b = sc.next(); b sc.next() sc.next sc int c = a.compareTo(b); c a.compareTo(b) a.compareTo a b if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            } c > 0 c 0 t += 3 t 3 if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            } c < 0 c 0 h += 3 h 3 {
                ++t;
                ++h;
            } ++t t ++h h System.out.printf("%d %d\n",t,h) System.out.printf System.out System System.out "%d %d\n" t h String[] args args public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),t = 0,h = 0;
        for(int i = 0;i < n;++i){
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        }
        System.out.printf("%d %d\n",t,h);
    }

} public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),t = 0,h = 0;
        for(int i = 0;i < n;++i){
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        }
        System.out.printf("%d %d\n",t,h);
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),t = 0,h = 0;
        for(int i = 0;i < n;++i){
            String a = sc.next(),b = sc.next();
            int c = a.compareTo(b);
            if(c > 0) t += 3;
            else if(c < 0) h += 3;
            else{
                ++t;
                ++h;
            }
        }
        System.out.printf("%d %d\n",t,h);
    }

}