/* ITP1_9_C */
import java.io.*;

class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      int n = Integer.parseInt(br.readLine());
      int taro = 0, hanaco = 0;

      for(int i = 0; i < n; i++){
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      }
      System.out.println(taro + " " + hanaco);
    }catch(Exception e){
      System.out.println(e);
    }
  }
} import java.io.*; io.* java class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      int n = Integer.parseInt(br.readLine());
      int taro = 0, hanaco = 0;

      for(int i = 0; i < n; i++){
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      }
      System.out.println(taro + " " + hanaco);
    }catch(Exception e){
      System.out.println(e);
    }
  }
} Main public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      int n = Integer.parseInt(br.readLine());
      int taro = 0, hanaco = 0;

      for(int i = 0; i < n; i++){
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      }
      System.out.println(taro + " " + hanaco);
    }catch(Exception e){
      System.out.println(e);
    }
  } main {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      int n = Integer.parseInt(br.readLine());
      int taro = 0, hanaco = 0;

      for(int i = 0; i < n; i++){
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      }
      System.out.println(taro + " " + hanaco);
    }catch(Exception e){
      System.out.println(e);
    }
  } try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      int n = Integer.parseInt(br.readLine());
      int taro = 0, hanaco = 0;

      for(int i = 0; i < n; i++){
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      }
      System.out.println(taro + " " + hanaco);
    }catch(Exception e){
      System.out.println(e);
    } catch(Exception e){
      System.out.println(e);
    } Exception e {
      System.out.println(e);
    } System.out.println(e) System.out.println System.out System System.out e {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      int n = Integer.parseInt(br.readLine());
      int taro = 0, hanaco = 0;

      for(int i = 0; i < n; i++){
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      }
      System.out.println(taro + " " + hanaco);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int taro = 0 taro 0 hanaco = 0; hanaco 0 for(int i = 0; i < n; i++){
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      } {
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      } String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String taro_card = str[0]; taro_card str[0] str 0 String hanaco_card = str[1]; hanaco_card str[1] str 1 int comp = taro_card.compareTo(hanaco_card); comp taro_card.compareTo(hanaco_card) taro_card.compareTo taro_card hanaco_card if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        } comp > 0 comp 0 taro += 3 taro 3 if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        } comp < 0 comp 0 hanaco += 3 hanaco 3 if(comp == 0){
          taro++;
          hanaco++;
        } comp == 0 comp 0 {
          taro++;
          hanaco++;
        } taro++ taro hanaco++ hanaco System.out.println(taro + " " + hanaco) System.out.println System.out System System.out taro + " " + hanaco taro + " " + hanaco taro " " hanaco String[] args args
/* ITP1_9_C */
import java.io.*;

class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      int n = Integer.parseInt(br.readLine());
      int taro = 0, hanaco = 0;

      for(int i = 0; i < n; i++){
        String[] str = br.readLine().split(" ");
        String taro_card = str[0];
        String hanaco_card = str[1];
        int comp = taro_card.compareTo(hanaco_card);

        if(comp > 0) taro += 3;
        else if(comp < 0 ) hanaco += 3;
        else if(comp == 0){
          taro++;
          hanaco++;
        }
      }
      System.out.println(taro + " " + hanaco);
    }catch(Exception e){
      System.out.println(e);
    }
  }
}