import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int sum1=0;
        int sum2=0;
        for (int i = 0; i < n; i++) {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        }
        System.out.println(sum1+" "+sum2);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int sum1=0;
        int sum2=0;
        for (int i = 0; i < n; i++) {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        }
        System.out.println(sum1+" "+sum2);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int sum1=0;
        int sum2=0;
        for (int i = 0; i < n; i++) {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        }
        System.out.println(sum1+" "+sum2);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int sum1=0;
        int sum2=0;
        for (int i = 0; i < n; i++) {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        }
        System.out.println(sum1+" "+sum2);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int sum1=0; sum1 0 int sum2=0; sum2 0 for (int i = 0; i < n; i++) {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        } {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        } String[] lines=br.readLine().split(" "); lines br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int result=lines[0].compareToIgnoreCase(lines[1]); result lines[0].compareToIgnoreCase(lines[1]) lines[0].compareToIgnoreCase lines[0] lines 0 lines[1] lines 1 sum1+=result==0?1:result>0?3:0 sum1 result==0?1:result>0?3:0 result==0 result 0 1 result>0?3:0 result>0 result 0 3 0 sum2+=result==0?1:result<0?3:0 sum2 result==0?1:result<0?3:0 result==0 result 0 1 result<0?3:0 result<0 result 0 3 0 System.out.println(sum1+" "+sum2) System.out.println System.out System System.out sum1+" "+sum2 sum1+" "+sum2 sum1 " " sum2 String[] args args public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int sum1=0;
        int sum2=0;
        for (int i = 0; i < n; i++) {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        }
        System.out.println(sum1+" "+sum2);
    }
} public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int sum1=0;
        int sum2=0;
        for (int i = 0; i < n; i++) {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        }
        System.out.println(sum1+" "+sum2);
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int sum1=0;
        int sum2=0;
        for (int i = 0; i < n; i++) {
            String[] lines=br.readLine().split(" ");
            int result=lines[0].compareToIgnoreCase(lines[1]);
            sum1+=result==0?1:result>0?3:0;
            sum2+=result==0?1:result<0?3:0;
        }
        System.out.println(sum1+" "+sum2);
    }
}