import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int taro_p = 0;
        int hanako_p = 0;
        int s = 0;
        for (int i = 0; i < n; i++) {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        }
        System.out.println(taro_p + " " + hanako_p);
    }
} 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();
        int taro_p = 0;
        int hanako_p = 0;
        int s = 0;
        for (int i = 0; i < n; i++) {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        }
        System.out.println(taro_p + " " + hanako_p);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int taro_p = 0;
        int hanako_p = 0;
        int s = 0;
        for (int i = 0; i < n; i++) {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        }
        System.out.println(taro_p + " " + hanako_p);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int taro_p = 0;
        int hanako_p = 0;
        int s = 0;
        for (int i = 0; i < n; i++) {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        }
        System.out.println(taro_p + " " + hanako_p);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int taro_p = 0; taro_p 0 int hanako_p = 0; hanako_p 0 int s = 0; s 0 for (int i = 0; i < n; i++) {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        } {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        } String taro = sc.next(); taro sc.next() sc.next sc String hanako = sc.next(); hanako sc.next() sc.next sc if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            } taro.length() == hanako.length() taro.length() taro.length taro hanako.length() hanako.length hanako { 
                s = taro.length();
            } s = taro.length() s taro.length() taro.length taro if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            } taro.length() < hanako.length() taro.length() taro.length taro hanako.length() hanako.length hanako {
                s = taro.length();
            } s = taro.length() s taro.length() taro.length taro {
                s = hanako.length();
            } s = hanako.length() s hanako.length() hanako.length hanako for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            } int j = 0; int j = 0; j 0 j < s j s j++ j++ j {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            } {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            } if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                } taro.equals(hanako) taro.equals taro hanako {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } taro_p += 1 taro_p 1 hanako_p += 1 hanako_p 1 break; if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                } (s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j) (s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length() s - 1 == j s - 1 s 1 j taro.charAt(j) == hanako.charAt(j) taro.charAt(j) taro.charAt taro j hanako.charAt(j) hanako.charAt hanako j taro.length() > hanako.length() taro.length() taro.length taro hanako.length() hanako.length hanako taro.charAt(j) > hanako.charAt(j) taro.charAt(j) taro.charAt taro j hanako.charAt(j) hanako.charAt hanako j {
                    taro_p += 3;
                    break;
                } taro_p += 3 taro_p 3 break; if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                } (s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j) (s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length() s - 1 == j s - 1 s 1 j taro.charAt(j) == hanako.charAt(j) taro.charAt(j) taro.charAt taro j hanako.charAt(j) hanako.charAt hanako j taro.length() < hanako.length() taro.length() taro.length taro hanako.length() hanako.length hanako taro.charAt(j) < hanako.charAt(j) taro.charAt(j) taro.charAt taro j hanako.charAt(j) hanako.charAt hanako j {
                    hanako_p += 3;
                    break;
                } hanako_p += 3 hanako_p 3 break; {
                   
                } System.out.println(taro_p + " " + hanako_p) System.out.println System.out System System.out taro_p + " " + hanako_p taro_p + " " + hanako_p taro_p " " hanako_p String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int taro_p = 0;
        int hanako_p = 0;
        int s = 0;
        for (int i = 0; i < n; i++) {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        }
        System.out.println(taro_p + " " + hanako_p);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int taro_p = 0;
        int hanako_p = 0;
        int s = 0;
        for (int i = 0; i < n; i++) {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        }
        System.out.println(taro_p + " " + hanako_p);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int taro_p = 0;
        int hanako_p = 0;
        int s = 0;
        for (int i = 0; i < n; i++) {
            String taro = sc.next();
            String hanako = sc.next();
            if (taro.length() == hanako.length()) { 
                s = taro.length();
            } else if (taro.length() < hanako.length()) {
                s = taro.length();
            } else {
                s = hanako.length();
            }
            for (int j = 0; j < s; j++) {
                if (taro.equals(hanako)) {
                    taro_p += 1;
                    hanako_p += 1;
                    break;
                } else if ((s - 1 == j && taro.charAt(j) == hanako.charAt(j) && taro.length() > hanako.length()) || taro.charAt(j) > hanako.charAt(j)) {
                    taro_p += 3;
                    break;
                } else if ((s - 1 == j &&  taro.charAt(j) == hanako.charAt(j) && taro.length() < hanako.length()) || taro.charAt(j) < hanako.charAt(j)) {
                    hanako_p += 3;
                    break;
                } else {
                   
                }
            }    
        }
        System.out.println(taro_p + " " + hanako_p);
    }
}