import java.util.Scanner;
public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	String n = scan.nextLine();
	int cnt = Integer.valueOf(n);
	int taro = 0;
	int hanako = 0;
	for (int i = 0; i < cnt; i++) {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	}
	System.out.println(taro + " " + hanako);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	String n = scan.nextLine();
	int cnt = Integer.valueOf(n);
	int taro = 0;
	int hanako = 0;
	for (int i = 0; i < cnt; i++) {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	}
	System.out.println(taro + " " + hanako);
    }
} Main public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	String n = scan.nextLine();
	int cnt = Integer.valueOf(n);
	int taro = 0;
	int hanako = 0;
	for (int i = 0; i < cnt; i++) {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	}
	System.out.println(taro + " " + hanako);
    } main {
	Scanner scan = new Scanner(System.in);
	String n = scan.nextLine();
	int cnt = Integer.valueOf(n);
	int taro = 0;
	int hanako = 0;
	for (int i = 0; i < cnt; i++) {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	}
	System.out.println(taro + " " + hanako);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String n = scan.nextLine(); n scan.nextLine() scan.nextLine scan int cnt = Integer.valueOf(n); cnt Integer.valueOf(n) Integer.valueOf Integer n int taro = 0; taro 0 int hanako = 0; hanako 0 for (int i = 0; i < cnt; i++) {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	} int i = 0; int i = 0; i 0 i < cnt i cnt i++ i++ i {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	} {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	} String fuda = scan.nextLine(); fuda scan.nextLine() scan.nextLine scan String[] cards = fuda.split(" "); cards fuda.split(" ") fuda.split fuda " " if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 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 if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    } cards[0].compareTo(cards[1]) < 0 cards[0].compareTo(cards[1]) cards[0].compareTo cards[0] cards 0 cards[1] cards 1 0 {
		hanako += 3;
	    } hanako += 3 hanako 3 if (cards[0].compareTo(cards[1]) > 0) {
		taro += 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 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){
	Scanner scan = new Scanner(System.in);
	String n = scan.nextLine();
	int cnt = Integer.valueOf(n);
	int taro = 0;
	int hanako = 0;
	for (int i = 0; i < cnt; i++) {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	}
	System.out.println(taro + " " + hanako);
    }
} public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	String n = scan.nextLine();
	int cnt = Integer.valueOf(n);
	int taro = 0;
	int hanako = 0;
	for (int i = 0; i < cnt; i++) {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	}
	System.out.println(taro + " " + hanako);
    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	String n = scan.nextLine();
	int cnt = Integer.valueOf(n);
	int taro = 0;
	int hanako = 0;
	for (int i = 0; i < cnt; i++) {
	    String fuda = scan.nextLine();
	    String[] cards = fuda.split(" ");
	    if (cards[0].compareTo(cards[1]) == 0) {
		taro += 1;
		hanako += 1;
	    } else if (cards[0].compareTo(cards[1]) < 0) {
		hanako += 3;
	    } else if (cards[0].compareTo(cards[1]) > 0) {
		taro += 3;
	    }
	}
	System.out.println(taro + " " + hanako);
    }
}