import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(sc.next());
        int a_score = 0;
        int b_score = 0;
        for (int i = 0; i < n; i++) {
            String a = sc.next();
            String b = sc.next();
            if (a.compareTo(b) < 0) {
                b_score += 3;
            } else if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            }
        }
        out.printf("%d %d\n", a_score, b_score);
        out.flush();
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(sc.next());
        int a_score = 0;
        int b_score = 0;
        for (int i = 0; i < n; i++) {
            String a = sc.next();
            String b = sc.next();
            if (a.compareTo(b) < 0) {
                b_score += 3;
            } else if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            }
        }
        out.printf("%d %d\n", a_score, b_score);
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(sc.next());
        int a_score = 0;
        int b_score = 0;
        for (int i = 0; i < n; i++) {
            String a = sc.next();
            String b = sc.next();
            if (a.compareTo(b) < 0) {
                b_score += 3;
            } else if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            }
        }
        out.printf("%d %d\n", a_score, b_score);
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(sc.next());
        int a_score = 0;
        int b_score = 0;
        for (int i = 0; i < n; i++) {
            String a = sc.next();
            String b = sc.next();
            if (a.compareTo(b) < 0) {
                b_score += 3;
            } else if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            }
        }
        out.printf("%d %d\n", a_score, b_score);
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int a_score = 0; a_score 0 int b_score = 0; b_score 0 for (int i = 0; i < n; i++) {
            String a = sc.next();
            String b = sc.next();
            if (a.compareTo(b) < 0) {
                b_score += 3;
            } else if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String a = sc.next();
            String b = sc.next();
            if (a.compareTo(b) < 0) {
                b_score += 3;
            } else if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            }
        } {
            String a = sc.next();
            String b = sc.next();
            if (a.compareTo(b) < 0) {
                b_score += 3;
            } else if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            }
        } String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc if (a.compareTo(b) < 0) {
                b_score += 3;
            } else if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            } a.compareTo(b) < 0 a.compareTo(b) a.compareTo a b 0 {
                b_score += 3;
            } b_score += 3 b_score 3 if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            } a.compareTo(b) > 0 a.compareTo(b) a.compareTo a b 0 {
                a_score += 3;
            } a_score += 3 a_score 3 {
                a_score++;
                b_score++;
            } a_score++ a_score b_score++ b_score out.printf("%d %d\n", a_score, b_score) out.printf out "%d %d\n" a_score b_score out.flush() out.flush out String[] args args
import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(sc.next());
        int a_score = 0;
        int b_score = 0;
        for (int i = 0; i < n; i++) {
            String a = sc.next();
            String b = sc.next();
            if (a.compareTo(b) < 0) {
                b_score += 3;
            } else if (a.compareTo(b) > 0) {
                a_score += 3;
            } else {
                a_score++;
                b_score++;
            }
        }
        out.printf("%d %d\n", a_score, b_score);
        out.flush();
    }
}
