import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int taro_score = 0;
        int hanako_score = 0;
        String taro_card;
        String hanako_card;
        int n = scan.nextInt();
        for (int i = 0; i < n; i++) {
            taro_card = scan.next();
            hanako_card = scan.next();
            if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            }
        }
        System.out.println(taro_score + " " + hanako_score);
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int taro_score = 0;
        int hanako_score = 0;
        String taro_card;
        String hanako_card;
        int n = scan.nextInt();
        for (int i = 0; i < n; i++) {
            taro_card = scan.next();
            hanako_card = scan.next();
            if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            }
        }
        System.out.println(taro_score + " " + hanako_score);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int taro_score = 0;
        int hanako_score = 0;
        String taro_card;
        String hanako_card;
        int n = scan.nextInt();
        for (int i = 0; i < n; i++) {
            taro_card = scan.next();
            hanako_card = scan.next();
            if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            }
        }
        System.out.println(taro_score + " " + hanako_score);
    } main {
        Scanner scan = new Scanner(System.in);
        int taro_score = 0;
        int hanako_score = 0;
        String taro_card;
        String hanako_card;
        int n = scan.nextInt();
        for (int i = 0; i < n; i++) {
            taro_card = scan.next();
            hanako_card = scan.next();
            if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            }
        }
        System.out.println(taro_score + " " + hanako_score);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int taro_score = 0; taro_score 0 int hanako_score = 0; hanako_score 0 String taro_card; taro_card String hanako_card; hanako_card int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan for (int i = 0; i < n; i++) {
            taro_card = scan.next();
            hanako_card = scan.next();
            if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            taro_card = scan.next();
            hanako_card = scan.next();
            if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            }
        } {
            taro_card = scan.next();
            hanako_card = scan.next();
            if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            }
        } taro_card = scan.next() taro_card scan.next() scan.next scan hanako_card = scan.next() hanako_card scan.next() scan.next scan if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            } taro_card.compareTo(hanako_card) > 0 taro_card.compareTo(hanako_card) taro_card.compareTo taro_card hanako_card 0 {
                taro_score += 3;
            } taro_score += 3 taro_score 3 if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            } taro_card.compareTo(hanako_card) == 0 taro_card.compareTo(hanako_card) taro_card.compareTo taro_card hanako_card 0 {
                taro_score += 1;
                hanako_score += 1;
            } taro_score += 1 taro_score 1 hanako_score += 1 hanako_score 1 {
                hanako_score += 3;
            } hanako_score += 3 hanako_score 3 System.out.println(taro_score + " " + hanako_score) System.out.println System.out System System.out taro_score + " " + hanako_score taro_score + " " + hanako_score taro_score " " hanako_score String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int taro_score = 0;
        int hanako_score = 0;
        String taro_card;
        String hanako_card;
        int n = scan.nextInt();
        for (int i = 0; i < n; i++) {
            taro_card = scan.next();
            hanako_card = scan.next();
            if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            }
        }
        System.out.println(taro_score + " " + hanako_score);
    }
}