import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,num;
        int a,b,i,j,x,y;
        str = scan.nextLine();
        a = Integer.valueOf(str);
        x = 0;
        y = 0;
        for(i=0;i<a;i++){
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        }
        System.out.println(x+" "+y);
        scan.close();

    }

}
 import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,num;
        int a,b,i,j,x,y;
        str = scan.nextLine();
        a = Integer.valueOf(str);
        x = 0;
        y = 0;
        for(i=0;i<a;i++){
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        }
        System.out.println(x+" "+y);
        scan.close();

    }

} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,num;
        int a,b,i,j,x,y;
        str = scan.nextLine();
        a = Integer.valueOf(str);
        x = 0;
        y = 0;
        for(i=0;i<a;i++){
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        }
        System.out.println(x+" "+y);
        scan.close();

    } main {
        Scanner scan = new Scanner(System.in);
        String str,num;
        int a,b,i,j,x,y;
        str = scan.nextLine();
        a = Integer.valueOf(str);
        x = 0;
        y = 0;
        for(i=0;i<a;i++){
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        }
        System.out.println(x+" "+y);
        scan.close();

    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str str num; num int a a b b i i j j x x y; y str = scan.nextLine() str scan.nextLine() scan.nextLine scan a = Integer.valueOf(str) a Integer.valueOf(str) Integer.valueOf Integer str x = 0 x 0 y = 0 y 0 for(i=0;i<a;i++){
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        } i=0; i=0 i 0 i<a i a i++ i++ i {
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        } {
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        } str = scan.nextLine() str scan.nextLine() scan.nextLine scan String[] words = str.split(" ", 0); words str.split(" ", 0) str.split str " " 0 if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            } words[0].equals(words[1]) words[0].equals words[0] words 0 words[1] words 1 {
                x += 1;
                y += 1;
            } x += 1 x 1 y += 1 y 1 {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            } if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                } words[0].length()>words[1].length() words[0].length() words[0].length words[0] words 0 words[1].length() words[1].length words[1] words 1 {
                    b = words[1].length();
                } b = words[1].length() b words[1].length() words[1].length words[1] words 1 {
                    b = words[0].length();
                } b = words[0].length() b words[0].length() words[0].length words[0] words 0 for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                } j = 0; j = 0 j 0 j < b j b j++ j++ j {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                } {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                } if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    } words[0].charAt(j)>words[1].charAt(j) words[0].charAt(j) words[0].charAt words[0] words 0 j words[1].charAt(j) words[1].charAt words[1] words 1 j {
                        x += 3;
                        break;
                    } x += 3 x 3 break; if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    } words[0].charAt(j)<words[1].charAt(j) words[0].charAt(j) words[0].charAt words[0] words 0 j words[1].charAt(j) words[1].charAt words[1] words 1 j {
                        y += 3;
                        break;
                    } y += 3 y 3 break; if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                } j == b j b {
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                } if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    } words[0].length()>words[1].length() words[0].length() words[0].length words[0] words 0 words[1].length() words[1].length words[1] words 1 {
                        x += 3;
                    } x += 3 x 3 {
                        y += 3;
                    } y += 3 y 3 System.out.println(x+" "+y) System.out.println System.out System System.out x+" "+y x+" "+y x " " y scan.close() scan.close scan String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,num;
        int a,b,i,j,x,y;
        str = scan.nextLine();
        a = Integer.valueOf(str);
        x = 0;
        y = 0;
        for(i=0;i<a;i++){
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        }
        System.out.println(x+" "+y);
        scan.close();

    }

} public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,num;
        int a,b,i,j,x,y;
        str = scan.nextLine();
        a = Integer.valueOf(str);
        x = 0;
        y = 0;
        for(i=0;i<a;i++){
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        }
        System.out.println(x+" "+y);
        scan.close();

    }

} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,num;
        int a,b,i,j,x,y;
        str = scan.nextLine();
        a = Integer.valueOf(str);
        x = 0;
        y = 0;
        for(i=0;i<a;i++){
            str = scan.nextLine();
            String[] words = str.split(" ", 0);
            if(words[0].equals(words[1])){
                x += 1;
                y += 1;
            }else {
                if(words[0].length()>words[1].length()){
                    b = words[1].length();
                }else{
                    b = words[0].length();
                }
                for (j = 0; j < b; j++) {
                    if(words[0].charAt(j)>words[1].charAt(j)){
                        x += 3;
                        break;
                    }else if(words[0].charAt(j)<words[1].charAt(j)){
                        y += 3;
                        break;
                    }
                }
                if(j == b){
                    if(words[0].length()>words[1].length()){
                        x += 3;
                    }else{
                        y += 3;
                    }
                }
            }
        }
        System.out.println(x+" "+y);
        scan.close();

    }

}

