import java.io.IOException;
import java.io.BufferedReader;
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;
        int hanako = 0;
        for (int i = 0; i < n; i++){
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro + " " + hanako);
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader 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;
        int hanako = 0;
        for (int i = 0; i < n; i++){
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }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;
        int hanako = 0;
        for (int i = 0; i < n; i++){
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }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;
        int hanako = 0;
        for (int i = 0; i < n; i++){
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }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 int hanako = 0; hanako 0 for (int i = 0; i < n; i++){
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }else{
                hanako += 3;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }else{
                hanako += 3;
            }
        } {
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }else{
                hanako += 3;
            }
        } String[] cards = br.readLine().split(" "); cards br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }else{
                hanako += 3;
            } cards[0].compareTo(cards[1])>0 cards[0].compareTo(cards[1]) cards[0].compareTo cards[0] cards 0 cards[1] cards 1 0 {
                taro += 3;
            } taro += 3 taro 3 if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }else{
                hanako += 3;
            } cards[0].compareTo(cards[1])==0 cards[0].compareTo(cards[1]) cards[0].compareTo cards[0] cards 0 cards[1] cards 1 0 {
                taro += 1;
                hanako += 1;
            } taro += 1 taro 1 hanako += 1 hanako 1 {
                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;
        int hanako = 0;
        for (int i = 0; i < n; i++){
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }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;
        int hanako = 0;
        for (int i = 0; i < n; i++){
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro + " " + hanako);
    }
} Main
import java.io.IOException;
import java.io.BufferedReader;
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;
        int hanako = 0;
        for (int i = 0; i < n; i++){
            String[] cards = br.readLine().split(" ");
            if (cards[0].compareTo(cards[1])>0){
                taro += 3;
            }else if (cards[0].compareTo(cards[1])==0){
                taro += 1;
                hanako += 1;
            }else{
                hanako += 3;
            }
        }
        System.out.println(taro + " " + hanako);
    }
}