import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n= Integer.parseInt(sc.nextLine());
		int taroPoint=0;
		int hanakoPoint=0;
		
		for(int i=0;i<n;i++){
			String[] word = sc.nextLine().split(" ");
			if(word[0].equals(word[1])){
				taroPoint+=1;
				hanakoPoint+=1;
			}else{
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			}
		}
		System.out.println(taroPoint+" "+hanakoPoint);
	}
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n= Integer.parseInt(sc.nextLine());
		int taroPoint=0;
		int hanakoPoint=0;
		
		for(int i=0;i<n;i++){
			String[] word = sc.nextLine().split(" ");
			if(word[0].equals(word[1])){
				taroPoint+=1;
				hanakoPoint+=1;
			}else{
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			}
		}
		System.out.println(taroPoint+" "+hanakoPoint);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n= Integer.parseInt(sc.nextLine());
		int taroPoint=0;
		int hanakoPoint=0;
		
		for(int i=0;i<n;i++){
			String[] word = sc.nextLine().split(" ");
			if(word[0].equals(word[1])){
				taroPoint+=1;
				hanakoPoint+=1;
			}else{
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			}
		}
		System.out.println(taroPoint+" "+hanakoPoint);
	} main {
		Scanner sc = new Scanner(System.in);
		int n= Integer.parseInt(sc.nextLine());
		int taroPoint=0;
		int hanakoPoint=0;
		
		for(int i=0;i<n;i++){
			String[] word = sc.nextLine().split(" ");
			if(word[0].equals(word[1])){
				taroPoint+=1;
				hanakoPoint+=1;
			}else{
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			}
		}
		System.out.println(taroPoint+" "+hanakoPoint);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n= Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int taroPoint=0; taroPoint 0 int hanakoPoint=0; hanakoPoint 0 for(int i=0;i<n;i++){
			String[] word = sc.nextLine().split(" ");
			if(word[0].equals(word[1])){
				taroPoint+=1;
				hanakoPoint+=1;
			}else{
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String[] word = sc.nextLine().split(" ");
			if(word[0].equals(word[1])){
				taroPoint+=1;
				hanakoPoint+=1;
			}else{
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			}
		} {
			String[] word = sc.nextLine().split(" ");
			if(word[0].equals(word[1])){
				taroPoint+=1;
				hanakoPoint+=1;
			}else{
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			}
		} String[] word = sc.nextLine().split(" "); word sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " if(word[0].equals(word[1])){
				taroPoint+=1;
				hanakoPoint+=1;
			}else{
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			} word[0].equals(word[1]) word[0].equals word[0] word 0 word[1] word 1 {
				taroPoint+=1;
				hanakoPoint+=1;
			} taroPoint+=1 taroPoint 1 hanakoPoint+=1 hanakoPoint 1 {
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			} int wordlength = word[0].length(); wordlength word[0].length() word[0].length word[0] word 0 if(wordlength>word[1].length()){
					wordlength=word[1].length();
				} wordlength>word[1].length() wordlength word[1].length() word[1].length word[1] word 1 {
					wordlength=word[1].length();
				} wordlength=word[1].length() wordlength word[1].length() word[1].length word[1] word 1 for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				} int j=0; int j=0; j 0 j<wordlength j wordlength j++ j++ j {
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				} {
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				} if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					} word[0].charAt(j)>word[1].charAt(j) word[0].charAt(j) word[0].charAt word[0] word 0 j word[1].charAt(j) word[1].charAt word[1] word 1 j {
						taroPoint+=3;
						break;
					} taroPoint+=3 taroPoint 3 break; if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					} word[0].charAt(j)<word[1].charAt(j) word[0].charAt(j) word[0].charAt word[0] word 0 j word[1].charAt(j) word[1].charAt word[1] word 1 j {
						hanakoPoint+=3;
						break;
					} hanakoPoint+=3 hanakoPoint 3 break; if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					} j==wordlength-1 j wordlength-1 wordlength 1 {
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					} if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						} word[0].length()>word[1].length() word[0].length() word[0].length word[0] word 0 word[1].length() word[1].length word[1] word 1 {
							taroPoint+=3;
						} taroPoint+=3 taroPoint 3 {
							hanakoPoint+=3;
						} hanakoPoint+=3 hanakoPoint 3 System.out.println(taroPoint+" "+hanakoPoint) System.out.println System.out System System.out taroPoint+" "+hanakoPoint taroPoint+" "+hanakoPoint taroPoint " " hanakoPoint String[] args args
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n= Integer.parseInt(sc.nextLine());
		int taroPoint=0;
		int hanakoPoint=0;
		
		for(int i=0;i<n;i++){
			String[] word = sc.nextLine().split(" ");
			if(word[0].equals(word[1])){
				taroPoint+=1;
				hanakoPoint+=1;
			}else{
				int wordlength = word[0].length();
				if(wordlength>word[1].length()){
					wordlength=word[1].length();
				}
				for(int j=0;j<wordlength;j++){
					if(word[0].charAt(j)>word[1].charAt(j)){
						taroPoint+=3;
						break;
					}else if(word[0].charAt(j)<word[1].charAt(j)){
						hanakoPoint+=3;
						break;
					}
					if(j==wordlength-1){
						if(word[0].length()>word[1].length()){
							taroPoint+=3;
						}else{
							hanakoPoint+=3;
						}
					}
				}
			}
		}
		System.out.println(taroPoint+" "+hanakoPoint);
	}
}