import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int n = Integer.parseInt(line);

        int taro = 0;
        int hanako = 0;
        for(int i = 0; i < n; i++) {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        }

        System.out.println(taro + " " + hanako);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int n = Integer.parseInt(line);

        int taro = 0;
        int hanako = 0;
        for(int i = 0; i < n; i++) {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        }

        System.out.println(taro + " " + hanako);
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int n = Integer.parseInt(line);

        int taro = 0;
        int hanako = 0;
        for(int i = 0; i < n; i++) {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        }

        System.out.println(taro + " " + hanako);
    } main {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int n = Integer.parseInt(line);

        int taro = 0;
        int hanako = 0;
        for(int i = 0; i < n; i++) {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        }

        System.out.println(taro + " " + hanako);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc int n = Integer.parseInt(line); n Integer.parseInt(line) Integer.parseInt Integer line int taro = 0; taro 0 int hanako = 0; hanako 0 for(int i = 0; i < n; i++) {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        } {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        } line = sc.nextLine() line sc.nextLine() sc.nextLine sc String[] l = line.split(" "); l line.split(" ") line.split line " " char[] t = l[0].toCharArray(); t l[0].toCharArray() l[0].toCharArray l[0] l 0 char[] h = l[1].toCharArray(); h l[1].toCharArray() l[1].toCharArray l[1] l 1 for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          } int j = 0; int j = 0; j 0 j < t.length j t.length t t.length j++ j++ j {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          } {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          } if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            } t[j] < h[j] t[j] t j h[j] h j {
              hanako += 3;
              break;
            } hanako += 3 hanako 3 break; if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            } t[j] > h[j] t[j] t j h[j] h j {
              taro += 3;
              break;
            } taro += 3 taro 3 break; if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            } j == t.length - 1 || j == h.length - 1 j == t.length - 1 j t.length - 1 t.length t t.length 1 j == h.length - 1 j h.length - 1 h.length h h.length 1 {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            } if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              } t.length < h.length t.length t t.length h.length h h.length {
                hanako += 3;
              } hanako += 3 hanako 3 if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              } t.length > h.length t.length t t.length h.length h h.length {
                taro += 3;
              } taro += 3 taro 3 {
                hanako++;
                taro++;
              } hanako++ hanako taro++ taro break; System.out.println(taro + " " + hanako) System.out.println System.out System System.out taro + " " + hanako taro + " " + hanako taro " " hanako String[] args args public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int n = Integer.parseInt(line);

        int taro = 0;
        int hanako = 0;
        for(int i = 0; i < n; i++) {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        }

        System.out.println(taro + " " + hanako);
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int n = Integer.parseInt(line);

        int taro = 0;
        int hanako = 0;
        for(int i = 0; i < n; i++) {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        }

        System.out.println(taro + " " + hanako);
    }
} Main
import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int n = Integer.parseInt(line);

        int taro = 0;
        int hanako = 0;
        for(int i = 0; i < n; i++) {
          line = sc.nextLine();
          String[] l = line.split(" ");
          char[] t = l[0].toCharArray();
          char[] h = l[1].toCharArray();

          for(int j = 0; j < t.length; j++) {
            if(t[j] < h[j]) {
              hanako += 3;
              break;
            } else if( t[j] > h[j]) {
              taro += 3;
              break;
            } else if(j == t.length - 1 || j == h.length - 1) {
              if(t.length < h.length) {
                hanako += 3;
              } else if(t.length > h.length) {
                taro += 3;
              } else {
                hanako++;
                taro++;
              }
              break;
            }
          }
        }

        System.out.println(taro + " " + hanako);
    }
}