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 taro=0,hanako=0;
        while(n-->0){
            String str[] = br.readLine().split(" ");
            if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro+" "+hanako);
    }
} 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 taro=0,hanako=0;
        while(n-->0){
            String str[] = br.readLine().split(" ");
            if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro+" "+hanako);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taro=0,hanako=0;
        while(n-->0){
            String str[] = br.readLine().split(" ");
            if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro+" "+hanako);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taro=0,hanako=0;
        while(n-->0){
            String str[] = br.readLine().split(" ");
            if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro+" "+hanako);
    } 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 taro=0 taro 0 hanako=0; hanako 0 while(n-->0){
            String str[] = br.readLine().split(" ");
            if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            }
        } n-->0 n-- n 0 {
            String str[] = br.readLine().split(" ");
            if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            }
        } String str[] = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            } str[0].compareToIgnoreCase(str[1])==0 str[0].compareToIgnoreCase(str[1]) str[0].compareToIgnoreCase str[0] str 0 str[1] str 1 0 {
                taro++;
                hanako++;
            } taro++ taro hanako++ hanako if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            } str[0].compareToIgnoreCase(str[1])>0 str[0].compareToIgnoreCase(str[1]) str[0].compareToIgnoreCase str[0] str 0 str[1] str 1 0 {
                taro += 3;
            } taro += 3 taro 3 {
                hanako += 3;
            } hanako += 3 hanako 3 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) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taro=0,hanako=0;
        while(n-->0){
            String str[] = br.readLine().split(" ");
            if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro+" "+hanako);
    }
} 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 taro=0,hanako=0;
        while(n-->0){
            String str[] = br.readLine().split(" ");
            if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro+" "+hanako);
    }
} 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 taro=0,hanako=0;
        while(n-->0){
            String str[] = br.readLine().split(" ");
            if(str[0].compareToIgnoreCase(str[1])==0){
                taro++;
                hanako++;
            }else if(str[0].compareToIgnoreCase(str[1])>0){
                taro += 3;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro+" "+hanako);
    }
}