import java.util.*;
public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        //t=太郎、h=花子
        String t,h;
        int score_t=0;
        int score_h=0;

        for(int i=0; i<n; i++){
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        }
        System.out.println(String.format("%d %d",score_t,score_h));

    }

}
 import java.util.*; util.* java public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        //t=太郎、h=花子
        String t,h;
        int score_t=0;
        int score_h=0;

        for(int i=0; i<n; i++){
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        }
        System.out.println(String.format("%d %d",score_t,score_h));

    }

} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        //t=太郎、h=花子
        String t,h;
        int score_t=0;
        int score_h=0;

        for(int i=0; i<n; i++){
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        }
        System.out.println(String.format("%d %d",score_t,score_h));

    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        //t=太郎、h=花子
        String t,h;
        int score_t=0;
        int score_h=0;

        for(int i=0; i<n; i++){
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        }
        System.out.println(String.format("%d %d",score_t,score_h));

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc String t t h; h int score_t=0; score_t 0 int score_h=0; score_h 0 for(int i=0; i<n; i++){
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        } {
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        } t = sc.next() t sc.next() sc.next sc h = sc.next() h sc.next() sc.next sc if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            } t.compareTo(h) == 0 t.compareTo(h) t.compareTo t h 0 {
                score_t += 1;
                score_h += 1;
            } score_t += 1 score_t 1 score_h += 1 score_h 1 if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            } t.compareTo(h) > 0 t.compareTo(h) t.compareTo t h 0 {
                score_t += 3;
            } score_t += 3 score_t 3 {
                score_h += 3;
            } score_h += 3 score_h 3 System.out.println(String.format("%d %d",score_t,score_h)) System.out.println System.out System System.out String.format("%d %d",score_t,score_h) String.format String "%d %d" score_t score_h String[] args args public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        //t=太郎、h=花子
        String t,h;
        int score_t=0;
        int score_h=0;

        for(int i=0; i<n; i++){
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        }
        System.out.println(String.format("%d %d",score_t,score_h));

    }

} public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        //t=太郎、h=花子
        String t,h;
        int score_t=0;
        int score_h=0;

        for(int i=0; i<n; i++){
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        }
        System.out.println(String.format("%d %d",score_t,score_h));

    }

} Main
import java.util.*;
public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        //t=太郎、h=花子
        String t,h;
        int score_t=0;
        int score_h=0;

        for(int i=0; i<n; i++){
            t = sc.next();
            h = sc.next();
            
            //同値
            if(t.compareTo(h) == 0){
                score_t += 1;
                score_h += 1;
            }
            //t>h
            else if(t.compareTo(h) > 0){
                score_t += 3;
            }
            //t<h
            else{
                score_h += 3;
            }
        }
        System.out.println(String.format("%d %d",score_t,score_h));

    }

}

