import java.util.Scanner;
import java.util.ArrayList;

class Main{
  public static void main(String[] arg){

    ArrayList <String> taro = new ArrayList <String>();
    ArrayList <String> hanako = new ArrayList <String>();
    

    Scanner in = new Scanner(System.in);

    String input = in.nextLine();
    int card_cnt = Integer.parseInt(input);

    for(int i=0; i<card_cnt; i++){
        input = in.nextLine();
        String [] tmp = input.split(" ", 0);
        taro.add(tmp[0]);
        hanako.add(tmp[1]);
    }

    // debug System.out.println(taro.toString());
    // debug System.out.println(hanako.toString());

    int taro_point = 0, hanako_point = 0;

    for(int i=0; i<taro.size(); i++){
        String taro_card = taro.get(i);
        String hanako_card = hanako.get(i);

        // debug System.out.println(taro_card + " " + hanako_card);
        // debug System.out.println(taro_card.compareTo(hanako_card));

        if(taro_card.compareTo(hanako_card) > 0){
            taro_point += 3;
        }
        else if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        }
        // debug System.out.println(taro_point + " " + hanako_point);

    }

    System.out.println(taro_point + " " + hanako_point);

  }
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util class Main{
  public static void main(String[] arg){

    ArrayList <String> taro = new ArrayList <String>();
    ArrayList <String> hanako = new ArrayList <String>();
    

    Scanner in = new Scanner(System.in);

    String input = in.nextLine();
    int card_cnt = Integer.parseInt(input);

    for(int i=0; i<card_cnt; i++){
        input = in.nextLine();
        String [] tmp = input.split(" ", 0);
        taro.add(tmp[0]);
        hanako.add(tmp[1]);
    }

    // debug System.out.println(taro.toString());
    // debug System.out.println(hanako.toString());

    int taro_point = 0, hanako_point = 0;

    for(int i=0; i<taro.size(); i++){
        String taro_card = taro.get(i);
        String hanako_card = hanako.get(i);

        // debug System.out.println(taro_card + " " + hanako_card);
        // debug System.out.println(taro_card.compareTo(hanako_card));

        if(taro_card.compareTo(hanako_card) > 0){
            taro_point += 3;
        }
        else if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        }
        // debug System.out.println(taro_point + " " + hanako_point);

    }

    System.out.println(taro_point + " " + hanako_point);

  }
} Main public static void main(String[] arg){

    ArrayList <String> taro = new ArrayList <String>();
    ArrayList <String> hanako = new ArrayList <String>();
    

    Scanner in = new Scanner(System.in);

    String input = in.nextLine();
    int card_cnt = Integer.parseInt(input);

    for(int i=0; i<card_cnt; i++){
        input = in.nextLine();
        String [] tmp = input.split(" ", 0);
        taro.add(tmp[0]);
        hanako.add(tmp[1]);
    }

    // debug System.out.println(taro.toString());
    // debug System.out.println(hanako.toString());

    int taro_point = 0, hanako_point = 0;

    for(int i=0; i<taro.size(); i++){
        String taro_card = taro.get(i);
        String hanako_card = hanako.get(i);

        // debug System.out.println(taro_card + " " + hanako_card);
        // debug System.out.println(taro_card.compareTo(hanako_card));

        if(taro_card.compareTo(hanako_card) > 0){
            taro_point += 3;
        }
        else if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        }
        // debug System.out.println(taro_point + " " + hanako_point);

    }

    System.out.println(taro_point + " " + hanako_point);

  } main {

    ArrayList <String> taro = new ArrayList <String>();
    ArrayList <String> hanako = new ArrayList <String>();
    

    Scanner in = new Scanner(System.in);

    String input = in.nextLine();
    int card_cnt = Integer.parseInt(input);

    for(int i=0; i<card_cnt; i++){
        input = in.nextLine();
        String [] tmp = input.split(" ", 0);
        taro.add(tmp[0]);
        hanako.add(tmp[1]);
    }

    // debug System.out.println(taro.toString());
    // debug System.out.println(hanako.toString());

    int taro_point = 0, hanako_point = 0;

    for(int i=0; i<taro.size(); i++){
        String taro_card = taro.get(i);
        String hanako_card = hanako.get(i);

        // debug System.out.println(taro_card + " " + hanako_card);
        // debug System.out.println(taro_card.compareTo(hanako_card));

        if(taro_card.compareTo(hanako_card) > 0){
            taro_point += 3;
        }
        else if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        }
        // debug System.out.println(taro_point + " " + hanako_point);

    }

    System.out.println(taro_point + " " + hanako_point);

  } ArrayList <String> taro = new ArrayList <String>(); taro new ArrayList <String>() ArrayList <String> hanako = new ArrayList <String>(); hanako new ArrayList <String>() Scanner in = new Scanner(System.in); in new Scanner(System.in) String input = in.nextLine(); input in.nextLine() in.nextLine in int card_cnt = Integer.parseInt(input); card_cnt Integer.parseInt(input) Integer.parseInt Integer input for(int i=0; i<card_cnt; i++){
        input = in.nextLine();
        String [] tmp = input.split(" ", 0);
        taro.add(tmp[0]);
        hanako.add(tmp[1]);
    } int i=0; int i=0; i 0 i<card_cnt i card_cnt i++ i++ i {
        input = in.nextLine();
        String [] tmp = input.split(" ", 0);
        taro.add(tmp[0]);
        hanako.add(tmp[1]);
    } {
        input = in.nextLine();
        String [] tmp = input.split(" ", 0);
        taro.add(tmp[0]);
        hanako.add(tmp[1]);
    } input = in.nextLine() input in.nextLine() in.nextLine in String [] tmp = input.split(" ", 0); tmp input.split(" ", 0) input.split input " " 0 taro.add(tmp[0]) taro.add taro tmp[0] tmp 0 hanako.add(tmp[1]) hanako.add hanako tmp[1] tmp 1 int taro_point = 0 taro_point 0 hanako_point = 0; hanako_point 0 for(int i=0; i<taro.size(); i++){
        String taro_card = taro.get(i);
        String hanako_card = hanako.get(i);

        // debug System.out.println(taro_card + " " + hanako_card);
        // debug System.out.println(taro_card.compareTo(hanako_card));

        if(taro_card.compareTo(hanako_card) > 0){
            taro_point += 3;
        }
        else if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        }
        // debug System.out.println(taro_point + " " + hanako_point);

    } int i=0; int i=0; i 0 i<taro.size() i taro.size() taro.size taro i++ i++ i {
        String taro_card = taro.get(i);
        String hanako_card = hanako.get(i);

        // debug System.out.println(taro_card + " " + hanako_card);
        // debug System.out.println(taro_card.compareTo(hanako_card));

        if(taro_card.compareTo(hanako_card) > 0){
            taro_point += 3;
        }
        else if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        }
        // debug System.out.println(taro_point + " " + hanako_point);

    } {
        String taro_card = taro.get(i);
        String hanako_card = hanako.get(i);

        // debug System.out.println(taro_card + " " + hanako_card);
        // debug System.out.println(taro_card.compareTo(hanako_card));

        if(taro_card.compareTo(hanako_card) > 0){
            taro_point += 3;
        }
        else if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        }
        // debug System.out.println(taro_point + " " + hanako_point);

    } String taro_card = taro.get(i); taro_card taro.get(i) taro.get taro i String hanako_card = hanako.get(i); hanako_card hanako.get(i) hanako.get hanako i if(taro_card.compareTo(hanako_card) > 0){
            taro_point += 3;
        }
        else if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        } taro_card.compareTo(hanako_card) > 0 taro_card.compareTo(hanako_card) taro_card.compareTo taro_card hanako_card 0 {
            taro_point += 3;
        } taro_point += 3 taro_point 3 if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        } taro_card.compareTo(hanako_card) < 0 taro_card.compareTo(hanako_card) taro_card.compareTo taro_card hanako_card 0 {
            hanako_point += 3;
        } hanako_point += 3 hanako_point 3 {
            taro_point += 1;
            hanako_point += 1;
        } taro_point += 1 taro_point 1 hanako_point += 1 hanako_point 1 System.out.println(taro_point + " " + hanako_point) System.out.println System.out System System.out taro_point + " " + hanako_point taro_point + " " + hanako_point taro_point " " hanako_point String[] arg arg
import java.util.Scanner;
import java.util.ArrayList;

class Main{
  public static void main(String[] arg){

    ArrayList <String> taro = new ArrayList <String>();
    ArrayList <String> hanako = new ArrayList <String>();
    

    Scanner in = new Scanner(System.in);

    String input = in.nextLine();
    int card_cnt = Integer.parseInt(input);

    for(int i=0; i<card_cnt; i++){
        input = in.nextLine();
        String [] tmp = input.split(" ", 0);
        taro.add(tmp[0]);
        hanako.add(tmp[1]);
    }

    // debug System.out.println(taro.toString());
    // debug System.out.println(hanako.toString());

    int taro_point = 0, hanako_point = 0;

    for(int i=0; i<taro.size(); i++){
        String taro_card = taro.get(i);
        String hanako_card = hanako.get(i);

        // debug System.out.println(taro_card + " " + hanako_card);
        // debug System.out.println(taro_card.compareTo(hanako_card));

        if(taro_card.compareTo(hanako_card) > 0){
            taro_point += 3;
        }
        else if(taro_card.compareTo(hanako_card) < 0){
            hanako_point += 3;
        } else {
            taro_point += 1;
            hanako_point += 1;
        }
        // debug System.out.println(taro_point + " " + hanako_point);

    }

    System.out.println(taro_point + " " + hanako_point);

  }
}