import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=0,h=0;
		int n=Integer.parseInt(br.readLine());			
		for(int i=0;i<n;i++){
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		}
		System.out.println(t+" "+h);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException 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 t=0,h=0;
		int n=Integer.parseInt(br.readLine());			
		for(int i=0;i<n;i++){
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		}
		System.out.println(t+" "+h);
	}
} Main public static void main(String[] args)throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=0,h=0;
		int n=Integer.parseInt(br.readLine());			
		for(int i=0;i<n;i++){
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		}
		System.out.println(t+" "+h);
	} main {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=0,h=0;
		int n=Integer.parseInt(br.readLine());			
		for(int i=0;i<n;i++){
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		}
		System.out.println(t+" "+h);
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int t=0 t 0 h=0; h 0 int n=Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for(int i=0;i<n;i++){
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		} {
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		} String [] card=br.readLine().split(" "); card br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3; card[0].compareToIgnoreCase(card[1])==0 card[0].compareToIgnoreCase(card[1]) card[0].compareToIgnoreCase card[0] card 0 card[1] card 1 0 {
				t++;h++;
			} t++ t h++ h if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3; card[0].compareToIgnoreCase(card[1])<0 card[0].compareToIgnoreCase(card[1]) card[0].compareToIgnoreCase card[0] card 0 card[1] card 1 0 {
				h +=3;
			} h +=3 h 3 t+=3 t 3 System.out.println(t+" "+h) System.out.println System.out System System.out t+" "+h t+" "+h t " " h String[] args args public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=0,h=0;
		int n=Integer.parseInt(br.readLine());			
		for(int i=0;i<n;i++){
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		}
		System.out.println(t+" "+h);
	}
} public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=0,h=0;
		int n=Integer.parseInt(br.readLine());			
		for(int i=0;i<n;i++){
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		}
		System.out.println(t+" "+h);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=0,h=0;
		int n=Integer.parseInt(br.readLine());			
		for(int i=0;i<n;i++){
			String [] card=br.readLine().split(" ");
			//文字列を大小比較する（compareTo, compareToIgnoreCase）
			if(card[0].compareToIgnoreCase(card[1])==0){
				t++;h++;
			}else if(card[0].compareToIgnoreCase(card[1])<0){
				h +=3;
			}else t+=3;
		}
		System.out.println(t+" "+h);
	}
}