import java.util.NoSuchElementException;
import java.util.Scanner;

public class  Main {
    private static int N = 1000;
    private static int S = 100;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }
}
 import java.util.NoSuchElementException; NoSuchElementException java.util import java.util.Scanner; Scanner java.util public class  Main {
    private static int N = 1000;
    private static int S = 100;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }
} Main private static int N = 1000; N 1000 private static int S = 100; S 100 public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        try {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) try {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        } NoSuchElementException
                | NumberFormatException e {
            System.out.println(e);
        } System.out.println(e) System.out.println System.out System System.out e {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } int ap = 0 ap 0 bp = 0; bp 0 int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            } sc.hasNext() sc.hasNext sc {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            } String[] cs = sc.nextLine().split(" "); cs sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                } n > N || cs[0].length() > S || cs[1].length() > S n > N || cs[0].length() > S || cs[1].length() > S n > N n N cs[0].length() > S cs[0].length() cs[0].length cs[0] cs 0 S cs[1].length() > S cs[1].length() cs[1].length cs[1] cs 1 S {
                    System.out.println("Condition is invalid.");
                } System.out.println("Condition is invalid.") System.out.println System.out System System.out "Condition is invalid." int c = cs[0].compareTo(cs[1]); c cs[0].compareTo(cs[1]) cs[0].compareTo cs[0] cs 0 cs[1] cs 1 if (c > 0) {
                    ap += 3;
                } c > 0 c 0 {
                    ap += 3;
                } ap += 3 ap 3 if (c == 0) {
                    ap++;
                    bp++;
                } c == 0 c 0 {
                    ap++;
                    bp++;
                } ap++ ap bp++ bp if (c < 0) {
                    bp += 3;
                } c < 0 c 0 {
                    bp += 3;
                } bp += 3 bp 3 System.out.println(ap + " " + bp) System.out.println System.out System System.out ap + " " + bp ap + " " + bp ap " " bp String[] args args public class  Main {
    private static int N = 1000;
    private static int S = 100;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }
} public class  Main {
    private static int N = 1000;
    private static int S = 100;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }
} Main
import java.util.NoSuchElementException;
import java.util.Scanner;

public class  Main {
    private static int N = 1000;
    private static int S = 100;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int ap = 0, bp = 0;
            int n = Integer.parseInt(sc.nextLine());
            while (sc.hasNext()) {
                String[] cs = sc.nextLine().split(" ");
                if (n > N || cs[0].length() > S || cs[1].length() > S) {
                    System.out.println("Condition is invalid.");
                }
                int c = cs[0].compareTo(cs[1]);
                if (c > 0) {
                    ap += 3;
                }
                if (c == 0) {
                    ap++;
                    bp++;
                }
                if (c < 0) {
                    bp += 3;
                }
            }
            System.out.println(ap + " " + bp);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }
}

