import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int turn = Integer.parseInt(br.readLine());
        int tarou = 0; int hanako = 0;
        for(int i = 0; i < turn; i++){
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(tarou+" "+hanako);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int turn = Integer.parseInt(br.readLine());
        int tarou = 0; int hanako = 0;
        for(int i = 0; i < turn; i++){
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(tarou+" "+hanako);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int turn = Integer.parseInt(br.readLine());
        int tarou = 0; int hanako = 0;
        for(int i = 0; i < turn; i++){
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(tarou+" "+hanako);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int turn = Integer.parseInt(br.readLine());
        int tarou = 0; int hanako = 0;
        for(int i = 0; i < turn; i++){
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(tarou+" "+hanako);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int turn = Integer.parseInt(br.readLine()); turn Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int tarou = 0; tarou 0 int hanako = 0; hanako 0 for(int i = 0; i < turn; i++){
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        } int i = 0; int i = 0; i 0 i < turn i turn i++ i++ i {
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        } {
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        } String[] card = br.readLine().split(" "); card br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            } card[0].compareToIgnoreCase(card[1]) == 0 card[0].compareToIgnoreCase(card[1]) card[0].compareToIgnoreCase card[0] card 0 card[1] card 1 0 {
                tarou++; hanako++;
            } tarou++ tarou hanako++ hanako if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            } card[0].compareToIgnoreCase(card[1]) > 0 card[0].compareToIgnoreCase(card[1]) card[0].compareToIgnoreCase card[0] card 0 card[1] card 1 0 {
                tarou += 3;
            } tarou += 3 tarou 3 {
                hanako += 3;
            } hanako += 3 hanako 3 System.out.println(tarou+" "+hanako) System.out.println System.out System System.out tarou+" "+hanako tarou+" "+hanako tarou " " hanako String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int turn = Integer.parseInt(br.readLine());
        int tarou = 0; int hanako = 0;
        for(int i = 0; i < turn; i++){
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(tarou+" "+hanako);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int turn = Integer.parseInt(br.readLine());
        int tarou = 0; int hanako = 0;
        for(int i = 0; i < turn; i++){
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(tarou+" "+hanako);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int turn = Integer.parseInt(br.readLine());
        int tarou = 0; int hanako = 0;
        for(int i = 0; i < turn; i++){
            String[] card = br.readLine().split(" ");
            if(card[0].compareToIgnoreCase(card[1]) == 0){
                tarou++; hanako++;
            }else if(card[0].compareToIgnoreCase(card[1]) > 0){
                tarou += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(tarou+" "+hanako);
    }
}