import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int tru = 0;
    int hnk = 0;

    for(int i = 0; i < n; i++){
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    }

    System.out.println(tru + " " + hnk);
  }
}
 import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int tru = 0;
    int hnk = 0;

    for(int i = 0; i < n; i++){
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    }

    System.out.println(tru + " " + hnk);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int tru = 0;
    int hnk = 0;

    for(int i = 0; i < n; i++){
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    }

    System.out.println(tru + " " + hnk);
  } main {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int tru = 0;
    int hnk = 0;

    for(int i = 0; i < n; i++){
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    }

    System.out.println(tru + " " + hnk);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int tru = 0; tru 0 int hnk = 0; hnk 0 for(int i = 0; i < n; i++){
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    } {
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    } String t = sc.next(); t sc.next() sc.next sc String h = sc.next(); h sc.next() sc.next sc if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      } t.compareTo(h) < 0 t.compareTo(h) t.compareTo t h 0 {
        hnk += 3;
      } hnk += 3 hnk 3 if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      } t.compareTo(h) > 0 t.compareTo(h) t.compareTo t h 0 {
        tru += 3;
      } tru += 3 tru 3 if(t.equals(h)){
        tru += 1;
        hnk += 1;
      } t.equals(h) t.equals t h {
        tru += 1;
        hnk += 1;
      } tru += 1 tru 1 hnk += 1 hnk 1 System.out.println(tru + " " + hnk) System.out.println System.out System System.out tru + " " + hnk tru + " " + hnk tru " " hnk String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int tru = 0;
    int hnk = 0;

    for(int i = 0; i < n; i++){
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    }

    System.out.println(tru + " " + hnk);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int tru = 0;
    int hnk = 0;

    for(int i = 0; i < n; i++){
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    }

    System.out.println(tru + " " + hnk);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int tru = 0;
    int hnk = 0;

    for(int i = 0; i < n; i++){
      String t = sc.next();
      String h = sc.next();

      if(t.compareTo(h) < 0){
        hnk += 3;
      } else if(t.compareTo(h) > 0){
        tru += 3;
      } else if(t.equals(h)){
        tru += 1;
        hnk += 1;
      }
    }

    System.out.println(tru + " " + hnk);
  }
}

