import static java.lang.System.out;
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int alphaAns = 0;
        int betaAns = 0;
        for (int i = 0; i < num; i++) {
            String alpha = scan.next();
            String beta = scan.next();
            if (alpha.compareTo(beta) == 0) {
                alphaAns++;
                betaAns++;
            } else if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            }
        }
        out.printf("%d %d\n", alphaAns, betaAns);
    }
} import static java.lang.System.out; import static java.lang.System.out; import static java.lang.System.out; import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int alphaAns = 0;
        int betaAns = 0;
        for (int i = 0; i < num; i++) {
            String alpha = scan.next();
            String beta = scan.next();
            if (alpha.compareTo(beta) == 0) {
                alphaAns++;
                betaAns++;
            } else if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            }
        }
        out.printf("%d %d\n", alphaAns, betaAns);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int alphaAns = 0;
        int betaAns = 0;
        for (int i = 0; i < num; i++) {
            String alpha = scan.next();
            String beta = scan.next();
            if (alpha.compareTo(beta) == 0) {
                alphaAns++;
                betaAns++;
            } else if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            }
        }
        out.printf("%d %d\n", alphaAns, betaAns);
    } main {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int alphaAns = 0;
        int betaAns = 0;
        for (int i = 0; i < num; i++) {
            String alpha = scan.next();
            String beta = scan.next();
            if (alpha.compareTo(beta) == 0) {
                alphaAns++;
                betaAns++;
            } else if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            }
        }
        out.printf("%d %d\n", alphaAns, betaAns);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan int alphaAns = 0; alphaAns 0 int betaAns = 0; betaAns 0 for (int i = 0; i < num; i++) {
            String alpha = scan.next();
            String beta = scan.next();
            if (alpha.compareTo(beta) == 0) {
                alphaAns++;
                betaAns++;
            } else if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            }
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            String alpha = scan.next();
            String beta = scan.next();
            if (alpha.compareTo(beta) == 0) {
                alphaAns++;
                betaAns++;
            } else if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            }
        } {
            String alpha = scan.next();
            String beta = scan.next();
            if (alpha.compareTo(beta) == 0) {
                alphaAns++;
                betaAns++;
            } else if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            }
        } String alpha = scan.next(); alpha scan.next() scan.next scan String beta = scan.next(); beta scan.next() scan.next scan if (alpha.compareTo(beta) == 0) {
                alphaAns++;
                betaAns++;
            } else if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            } alpha.compareTo(beta) == 0 alpha.compareTo(beta) alpha.compareTo alpha beta 0 {
                alphaAns++;
                betaAns++;
            } alphaAns++ alphaAns betaAns++ betaAns if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            } alpha.compareTo(beta) > 0 alpha.compareTo(beta) alpha.compareTo alpha beta 0 {                    
                alphaAns += 3;
            } alphaAns += 3 alphaAns 3 {
                betaAns += 3;
            } betaAns += 3 betaAns 3 out.printf("%d %d\n", alphaAns, betaAns) out.printf out "%d %d\n" alphaAns betaAns String[] args args
import static java.lang.System.out;
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int alphaAns = 0;
        int betaAns = 0;
        for (int i = 0; i < num; i++) {
            String alpha = scan.next();
            String beta = scan.next();
            if (alpha.compareTo(beta) == 0) {
                alphaAns++;
                betaAns++;
            } else if (alpha.compareTo(beta) > 0) {                    
                alphaAns += 3;
            } else {
                betaAns += 3;
            }
        }
        out.printf("%d %d\n", alphaAns, betaAns);
    }
}