import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taro = 0, hanako = 0;
        int i, j;
        char taroCard, hanakoCard;
        String[] cards;

        outside: for (i = 0; i < n; i++) {
            cards = br.readLine().split(" ");

            for (j = 0; j < cards[0].length() && j < cards[1].length(); j++) {
                taroCard = cards[0].charAt(j);
                hanakoCard = cards[1].charAt(j);
                if (taroCard > hanakoCard) {
                    taro += 3;
                    continue outside;
                } else if (taroCard < hanakoCard) {
                    hanako += 3;
                    continue outside;
                }
            }

            if (cards[0].length() > cards[1].length()) {
                taro += 3;
            } else if (cards[0].length() < cards[1].length()) {
                hanako += 3;
            } else {
                taro++;
                hanako++;
            }
        }

        System.out.println(taro + " " + hanako);
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz