import java.util.Scanner;

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

        int n = sc.nextInt();
        sc.nextLine();
        int pa = 0;
        int pb = 0;
        for (int i = 0; i < n; i++) {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        }
        System.out.println(pa + " " + pb);
    }
} 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();
        sc.nextLine();
        int pa = 0;
        int pb = 0;
        for (int i = 0; i < n; i++) {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        }
        System.out.println(pa + " " + pb);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        sc.nextLine();
        int pa = 0;
        int pb = 0;
        for (int i = 0; i < n; i++) {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        }
        System.out.println(pa + " " + pb);
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        sc.nextLine();
        int pa = 0;
        int pb = 0;
        for (int i = 0; i < n; i++) {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        }
        System.out.println(pa + " " + pb);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc int pa = 0; pa 0 int pb = 0; pb 0 for (int i = 0; i < n; i++) {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        } {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        } String[] words = sc.nextLine().split(" "); words sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int c = words[0].compareTo(words[1]); c words[0].compareTo(words[1]) words[0].compareTo words[0] words 0 words[1] words 1 if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            } c == 0 c 0 {
                pa++;
                pb++;
            } pa++ pa pb++ pb if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            } c > 0 c 0 {
                pa += 3;
            } pa += 3 pa 3 {
                pb += 3;
            } pb += 3 pb 3 System.out.println(pa + " " + pb) System.out.println System.out System System.out pa + " " + pb pa + " " + pb pa " " pb String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        sc.nextLine();
        int pa = 0;
        int pb = 0;
        for (int i = 0; i < n; i++) {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        }
        System.out.println(pa + " " + pb);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        sc.nextLine();
        int pa = 0;
        int pb = 0;
        for (int i = 0; i < n; i++) {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        }
        System.out.println(pa + " " + pb);
    }
} Main
import java.util.Scanner;

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

        int n = sc.nextInt();
        sc.nextLine();
        int pa = 0;
        int pb = 0;
        for (int i = 0; i < n; i++) {
            String[] words = sc.nextLine().split(" ");
            int c = words[0].compareTo(words[1]);
            if (c == 0) {
                pa++;
                pb++;
            } else if (c > 0) {
                pa += 3;
            } else {
                pb += 3;
            }
        }
        System.out.println(pa + " " + pb);
    }
}