import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int tp = 0;
        int hp = 0;

        for(int i=0;i<n;i++){
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        }

        System.out.println(tp+" "+hp);

        scn.close();
    }

} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int tp = 0;
        int hp = 0;

        for(int i=0;i<n;i++){
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        }

        System.out.println(tp+" "+hp);

        scn.close();
    }

} Main public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int tp = 0;
        int hp = 0;

        for(int i=0;i<n;i++){
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        }

        System.out.println(tp+" "+hp);

        scn.close();
    } main {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int tp = 0;
        int hp = 0;

        for(int i=0;i<n;i++){
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        }

        System.out.println(tp+" "+hp);

        scn.close();
    } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int n = scn.nextInt(); n scn.nextInt() scn.nextInt scn int tp = 0; tp 0 int hp = 0; hp 0 for(int i=0;i<n;i++){
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        } {
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        } String tt = scn.next(); tt scn.next() scn.next scn String ht = scn.next(); ht scn.next() scn.next scn int result = tt.compareTo(ht); result tt.compareTo(ht) tt.compareTo tt ht if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            } result<0 result 0 {
                hp +=3;
            } hp +=3 hp 3 if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            } result>0 result 0 {
                tp +=3;
            } tp +=3 tp 3 {
                tp +=1;
                hp +=1;
            } tp +=1 tp 1 hp +=1 hp 1 System.out.println(tp+" "+hp) System.out.println System.out System System.out tp+" "+hp tp+" "+hp tp " " hp scn.close() scn.close scn String args[] args public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int tp = 0;
        int hp = 0;

        for(int i=0;i<n;i++){
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        }

        System.out.println(tp+" "+hp);

        scn.close();
    }

} public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int tp = 0;
        int hp = 0;

        for(int i=0;i<n;i++){
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        }

        System.out.println(tp+" "+hp);

        scn.close();
    }

} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int tp = 0;
        int hp = 0;

        for(int i=0;i<n;i++){
            String tt = scn.next();
            String ht = scn.next();
            int result = tt.compareTo(ht);
            if (result<0){
                hp +=3;
            }else if(result>0){
                tp +=3;
            }else{
                tp +=1;
                hp +=1;
            }
        }

        System.out.println(tp+" "+hp);

        scn.close();
    }

}
