import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] strArray = new String[n];
        int taroSum = 0;
        int hanacoSum = 0;
        for(int i = 0; i < n; i++){
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        }
        System.out.println(taroSum + " " + hanacoSum);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] strArray = new String[n];
        int taroSum = 0;
        int hanacoSum = 0;
        for(int i = 0; i < n; i++){
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        }
        System.out.println(taroSum + " " + hanacoSum);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] strArray = new String[n];
        int taroSum = 0;
        int hanacoSum = 0;
        for(int i = 0; i < n; i++){
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        }
        System.out.println(taroSum + " " + hanacoSum);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] strArray = new String[n];
        int taroSum = 0;
        int hanacoSum = 0;
        for(int i = 0; i < n; i++){
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        }
        System.out.println(taroSum + " " + hanacoSum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String[] strArray = new String[n]; strArray new String[n] n int taroSum = 0; taroSum 0 int hanacoSum = 0; hanacoSum 0 for(int i = 0; i < n; i++){
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        } {
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        } String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc int result = a.compareTo(b); result a.compareTo(b) a.compareTo a b if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            } result == 0 result 0 {
                taroSum++;
                hanacoSum++;
            } taroSum++ taroSum hanacoSum++ hanacoSum if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            } result < 0 result 0 {
                hanacoSum += 3;
            } hanacoSum += 3 hanacoSum 3 {
                taroSum += 3;
            } taroSum += 3 taroSum 3 System.out.println(taroSum + " " + hanacoSum) System.out.println System.out System System.out taroSum + " " + hanacoSum taroSum + " " + hanacoSum taroSum " " hanacoSum String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] strArray = new String[n];
        int taroSum = 0;
        int hanacoSum = 0;
        for(int i = 0; i < n; i++){
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        }
        System.out.println(taroSum + " " + hanacoSum);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] strArray = new String[n];
        int taroSum = 0;
        int hanacoSum = 0;
        for(int i = 0; i < n; i++){
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        }
        System.out.println(taroSum + " " + hanacoSum);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] strArray = new String[n];
        int taroSum = 0;
        int hanacoSum = 0;
        for(int i = 0; i < n; i++){
            String a = sc.next();
            String b = sc.next();
            int result = a.compareTo(b);
            if(result == 0){
                taroSum++;
                hanacoSum++;
            }else if(result < 0){
                hanacoSum += 3;
            }else{
                taroSum += 3;
            }
        }
        System.out.println(taroSum + " " + hanacoSum);
    }
}
