
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int aScore = 0;
		int bScore = 0;
		for(int i = 0; i < n; i++){
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		}
		System.out.println(aScore + " " + bScore);
	}
}
 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();
		int aScore = 0;
		int bScore = 0;
		for(int i = 0; i < n; i++){
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		}
		System.out.println(aScore + " " + bScore);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int aScore = 0;
		int bScore = 0;
		for(int i = 0; i < n; i++){
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		}
		System.out.println(aScore + " " + bScore);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int aScore = 0;
		int bScore = 0;
		for(int i = 0; i < n; i++){
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		}
		System.out.println(aScore + " " + bScore);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int aScore = 0; aScore 0 int bScore = 0; bScore 0 for(int i = 0; i < n; i++){
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		} {
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		} String aCard = sc.next(); aCard sc.next() sc.next sc String bCard = sc.next(); bCard sc.next() sc.next sc int conp = aCard.compareTo(bCard); conp aCard.compareTo(bCard) aCard.compareTo aCard bCard if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			} conp == 0 conp 0 {
				aScore += 1;
				bScore += 1;
			} aScore += 1 aScore 1 bScore += 1 bScore 1 {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			} if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				} conp > 0 conp 0 {
					aScore += 3;
				} aScore += 3 aScore 3 {
					bScore += 3;
				} bScore += 3 bScore 3 System.out.println(aScore + " " + bScore) System.out.println System.out System System.out aScore + " " + bScore aScore + " " + bScore aScore " " bScore String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int aScore = 0;
		int bScore = 0;
		for(int i = 0; i < n; i++){
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		}
		System.out.println(aScore + " " + bScore);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int aScore = 0;
		int bScore = 0;
		for(int i = 0; i < n; i++){
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		}
		System.out.println(aScore + " " + bScore);
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int aScore = 0;
		int bScore = 0;
		for(int i = 0; i < n; i++){
			String aCard = sc.next();
			String bCard = sc.next();
			int conp = aCard.compareTo(bCard);
			if(conp == 0){
				aScore += 1;
				bScore += 1;
			}else {
				if(conp > 0){
					aScore += 3;
				}else{
					bScore += 3;
				}
			}
		}
		System.out.println(aScore + " " + bScore);
	}
}

