import java.util.Scanner;

public class Main {
	public static Scanner sc;
	public static void main(String[] args){
		sc=new Scanner(System.in);
		String taro,hana;
		int tp=0,hp=0;
		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			taro=sc.next();
			hana=sc.next();
			if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3;
		}
		System.out.println(tp+" "+hp);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static Scanner sc;
	public static void main(String[] args){
		sc=new Scanner(System.in);
		String taro,hana;
		int tp=0,hp=0;
		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			taro=sc.next();
			hana=sc.next();
			if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3;
		}
		System.out.println(tp+" "+hp);
	}
} Main public static Scanner sc; sc public static void main(String[] args){
		sc=new Scanner(System.in);
		String taro,hana;
		int tp=0,hp=0;
		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			taro=sc.next();
			hana=sc.next();
			if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3;
		}
		System.out.println(tp+" "+hp);
	} main {
		sc=new Scanner(System.in);
		String taro,hana;
		int tp=0,hp=0;
		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			taro=sc.next();
			hana=sc.next();
			if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3;
		}
		System.out.println(tp+" "+hp);
	} sc=new Scanner(System.in) sc new Scanner(System.in) String taro taro hana; hana int tp=0 tp 0 hp=0; hp 0 int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i=0;i<n;i++){
			taro=sc.next();
			hana=sc.next();
			if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			taro=sc.next();
			hana=sc.next();
			if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3;
		} {
			taro=sc.next();
			hana=sc.next();
			if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3;
		} taro=sc.next() taro sc.next() sc.next sc hana=sc.next() hana sc.next() sc.next sc if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3; taro.compareTo(hana)==0 taro.compareTo(hana) taro.compareTo taro hana 0 {
				tp+=1;
				hp+=1;
			} tp+=1 tp 1 hp+=1 hp 1 if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3; taro.compareTo(hana)>0 taro.compareTo(hana) taro.compareTo taro hana 0 tp+=3 tp 3 hp+=3 hp 3 System.out.println(tp+" "+hp) System.out.println System.out System System.out tp+" "+hp tp+" "+hp tp " " hp String[] args args public class Main {
	public static Scanner sc;
	public static void main(String[] args){
		sc=new Scanner(System.in);
		String taro,hana;
		int tp=0,hp=0;
		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			taro=sc.next();
			hana=sc.next();
			if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3;
		}
		System.out.println(tp+" "+hp);
	}
} public class Main {
	public static Scanner sc;
	public static void main(String[] args){
		sc=new Scanner(System.in);
		String taro,hana;
		int tp=0,hp=0;
		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			taro=sc.next();
			hana=sc.next();
			if(taro.compareTo(hana)==0){
				tp+=1;
				hp+=1;
			}else if(taro.compareTo(hana)>0)tp+=3;
			else hp+=3;
		}
		System.out.println(tp+" "+hp);
	}
} Main
import java.util.Scanner;

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