import java.util.*;
import java.text.*;

class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        Comparator<String> cs = new Comparator<String>() {
            public int compare(String s1, String s2) {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            }
            public boolean equals(Object o) {
                return o == this;
            }
        };
        int n = sc.nextInt();
        int c1 = 0, c2 = 0;
        while(n-->0){
            String x = sc.next();
            String y = sc.next();
            int c = cs.compare(x, y);
            if(c < 0) {
                c2 += 3;
            } else if(c > 0) {
                c1 += 3;
            } else {
                c2 ++;
                c1 ++;
            }
        }
        System.out.println("" + c1 + " " + c2);
    }
} Comparator<String>() {
            public int compare(String s1, String s2) {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            }
            public boolean equals(Object o) {
                return o == this;
            }
        } public int compare(String s1, String s2) {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            } compare {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            } int l1 = s1.length(); l1 s1.length() s1.length s1 int l2 = s2.length(); l2 s2.length() s2.length s2 int l = Math.min(l1, l2); l Math.min(l1, l2) Math.min Math l1 l2 for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                } int i = 0; int i = 0; i 0 i < l i l i++ i++ i {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                } {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                } int d = s1.charAt(i) - s2.charAt(i); d s1.charAt(i) - s2.charAt(i) s1.charAt(i) s1.charAt s1 i s2.charAt(i) s2.charAt s2 i if(d != 0) return d; d != 0 d 0 return d; d return l1 - l2; l1 - l2 l1 l2 String s1 s1 String s2 s2 public boolean equals(Object o) {
                return o == this;
            } equals {
                return o == this;
            } return o == this; o == this o this Object o o import java.util.*; util.* java import java.text.*; text.* java class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        Comparator<String> cs = new Comparator<String>() {
            public int compare(String s1, String s2) {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            }
            public boolean equals(Object o) {
                return o == this;
            }
        };
        int n = sc.nextInt();
        int c1 = 0, c2 = 0;
        while(n-->0){
            String x = sc.next();
            String y = sc.next();
            int c = cs.compare(x, y);
            if(c < 0) {
                c2 += 3;
            } else if(c > 0) {
                c1 += 3;
            } else {
                c2 ++;
                c1 ++;
            }
        }
        System.out.println("" + c1 + " " + c2);
    }
} Main public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        Comparator<String> cs = new Comparator<String>() {
            public int compare(String s1, String s2) {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            }
            public boolean equals(Object o) {
                return o == this;
            }
        };
        int n = sc.nextInt();
        int c1 = 0, c2 = 0;
        while(n-->0){
            String x = sc.next();
            String y = sc.next();
            int c = cs.compare(x, y);
            if(c < 0) {
                c2 += 3;
            } else if(c > 0) {
                c1 += 3;
            } else {
                c2 ++;
                c1 ++;
            }
        }
        System.out.println("" + c1 + " " + c2);
    } main {
        Scanner sc = new Scanner(System.in);
        Comparator<String> cs = new Comparator<String>() {
            public int compare(String s1, String s2) {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            }
            public boolean equals(Object o) {
                return o == this;
            }
        };
        int n = sc.nextInt();
        int c1 = 0, c2 = 0;
        while(n-->0){
            String x = sc.next();
            String y = sc.next();
            int c = cs.compare(x, y);
            if(c < 0) {
                c2 += 3;
            } else if(c > 0) {
                c1 += 3;
            } else {
                c2 ++;
                c1 ++;
            }
        }
        System.out.println("" + c1 + " " + c2);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Comparator<String> cs = new Comparator<String>() {
            public int compare(String s1, String s2) {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            }
            public boolean equals(Object o) {
                return o == this;
            }
        }; cs new Comparator<String>() {
            public int compare(String s1, String s2) {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            }
            public boolean equals(Object o) {
                return o == this;
            }
        } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int c1 = 0 c1 0 c2 = 0; c2 0 while(n-->0){
            String x = sc.next();
            String y = sc.next();
            int c = cs.compare(x, y);
            if(c < 0) {
                c2 += 3;
            } else if(c > 0) {
                c1 += 3;
            } else {
                c2 ++;
                c1 ++;
            }
        } n-->0 n-- n 0 {
            String x = sc.next();
            String y = sc.next();
            int c = cs.compare(x, y);
            if(c < 0) {
                c2 += 3;
            } else if(c > 0) {
                c1 += 3;
            } else {
                c2 ++;
                c1 ++;
            }
        } String x = sc.next(); x sc.next() sc.next sc String y = sc.next(); y sc.next() sc.next sc int c = cs.compare(x, y); c cs.compare(x, y) cs.compare cs x y if(c < 0) {
                c2 += 3;
            } else if(c > 0) {
                c1 += 3;
            } else {
                c2 ++;
                c1 ++;
            } c < 0 c 0 {
                c2 += 3;
            } c2 += 3 c2 3 if(c > 0) {
                c1 += 3;
            } else {
                c2 ++;
                c1 ++;
            } c > 0 c 0 {
                c1 += 3;
            } c1 += 3 c1 3 {
                c2 ++;
                c1 ++;
            } c2 ++ c2 c1 ++ c1 System.out.println("" + c1 + " " + c2) System.out.println System.out System System.out "" + c1 + " " + c2 " " "" + c1 + " " + c2 "" c1 " " c2 String[]args args
import java.util.*;
import java.text.*;

class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        Comparator<String> cs = new Comparator<String>() {
            public int compare(String s1, String s2) {
                int l1 = s1.length();
                int l2 = s2.length();
                int l = Math.min(l1, l2);
                for(int i = 0; i < l; i++) {
                    int d = s1.charAt(i) - s2.charAt(i);
                    if(d != 0) return d;
                }
                return l1 - l2;
            }
            public boolean equals(Object o) {
                return o == this;
            }
        };
        int n = sc.nextInt();
        int c1 = 0, c2 = 0;
        while(n-->0){
            String x = sc.next();
            String y = sc.next();
            int c = cs.compare(x, y);
            if(c < 0) {
                c2 += 3;
            } else if(c > 0) {
                c1 += 3;
            } else {
                c2 ++;
                c1 ++;
            }
        }
        System.out.println("" + c1 + " " + c2);
    }
}