public class Main {
    public static void main(String[] args) {

        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = sc.nextInt();

        int taro_point = 0, hanako_point = 0;
        String taro_card, hanako_card;
        for (int i = 0; i < n; i ++) {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        }
        System.out.println(taro_point + " " + hanako_point);
    }
} public class Main {
    public static void main(String[] args) {

        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = sc.nextInt();

        int taro_point = 0, hanako_point = 0;
        String taro_card, hanako_card;
        for (int i = 0; i < n; i ++) {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        }
        System.out.println(taro_point + " " + hanako_point);
    }
} Main public static void main(String[] args) {

        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = sc.nextInt();

        int taro_point = 0, hanako_point = 0;
        String taro_card, hanako_card;
        for (int i = 0; i < n; i ++) {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        }
        System.out.println(taro_point + " " + hanako_point);
    } main {

        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = sc.nextInt();

        int taro_point = 0, hanako_point = 0;
        String taro_card, hanako_card;
        for (int i = 0; i < n; i ++) {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        }
        System.out.println(taro_point + " " + hanako_point);
    } java.util.Scanner sc = new java.util.Scanner(System.in); sc new java.util.Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int taro_point = 0 taro_point 0 hanako_point = 0; hanako_point 0 String taro_card taro_card hanako_card; hanako_card for (int i = 0; i < n; i ++) {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        } int i = 0; int i = 0; i 0 i < n i n i ++ i ++ i {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        } {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        } taro_card = sc.next() taro_card sc.next() sc.next sc hanako_card = sc.next() hanako_card sc.next() sc.next sc if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; } taro_card.compareToIgnoreCase(hanako_card) > 0 taro_card.compareToIgnoreCase(hanako_card) taro_card.compareToIgnoreCase taro_card hanako_card 0 { taro_point += 3; } taro_point += 3 taro_point 3 if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; } taro_card.compareToIgnoreCase(hanako_card) == 0 taro_card.compareToIgnoreCase(hanako_card) taro_card.compareToIgnoreCase taro_card hanako_card 0 { hanako_point ++; taro_point ++; } hanako_point ++ hanako_point taro_point ++ taro_point if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; } taro_card.compareToIgnoreCase(hanako_card) < 0 taro_card.compareToIgnoreCase(hanako_card) taro_card.compareToIgnoreCase taro_card hanako_card 0 { hanako_point += 3; } hanako_point += 3 hanako_point 3 System.out.println(taro_point + " " + hanako_point) System.out.println System.out System System.out taro_point + " " + hanako_point taro_point + " " + hanako_point taro_point " " hanako_point String[] args args public class Main {
    public static void main(String[] args) {

        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = sc.nextInt();

        int taro_point = 0, hanako_point = 0;
        String taro_card, hanako_card;
        for (int i = 0; i < n; i ++) {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        }
        System.out.println(taro_point + " " + hanako_point);
    }
} public class Main {
    public static void main(String[] args) {

        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = sc.nextInt();

        int taro_point = 0, hanako_point = 0;
        String taro_card, hanako_card;
        for (int i = 0; i < n; i ++) {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        }
        System.out.println(taro_point + " " + hanako_point);
    }
} Main
public class Main {
    public static void main(String[] args) {

        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = sc.nextInt();

        int taro_point = 0, hanako_point = 0;
        String taro_card, hanako_card;
        for (int i = 0; i < n; i ++) {
            taro_card = sc.next();
            hanako_card = sc.next();
            if (taro_card.compareToIgnoreCase(hanako_card) > 0) { taro_point += 3; }
            if (taro_card.compareToIgnoreCase(hanako_card) == 0) { hanako_point ++; taro_point ++; }
            if (taro_card.compareToIgnoreCase(hanako_card) < 0) { hanako_point += 3; }
        }
        System.out.println(taro_point + " " + hanako_point);
    }
}