import java.util.Scanner;

class Main {
	public static void main(String args[]){	
		Scanner scan = new Scanner(System.in);
				
		int n, ap, bp, a;
		String str, str2;
		
		ap = 0;
		bp = 0;
		
		n = scan.nextInt();
		for(int i = 0; i < n; i++){
			str = scan.next();
			str2 = scan.next();
			
			a = str.compareTo(str2);
			
			if(a > 0){
				ap += 3;
			}else if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			}
			
		}
			System.out.println(ap + " " + bp);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String args[]){	
		Scanner scan = new Scanner(System.in);
				
		int n, ap, bp, a;
		String str, str2;
		
		ap = 0;
		bp = 0;
		
		n = scan.nextInt();
		for(int i = 0; i < n; i++){
			str = scan.next();
			str2 = scan.next();
			
			a = str.compareTo(str2);
			
			if(a > 0){
				ap += 3;
			}else if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			}
			
		}
			System.out.println(ap + " " + bp);
	}
} Main public static void main(String args[]){	
		Scanner scan = new Scanner(System.in);
				
		int n, ap, bp, a;
		String str, str2;
		
		ap = 0;
		bp = 0;
		
		n = scan.nextInt();
		for(int i = 0; i < n; i++){
			str = scan.next();
			str2 = scan.next();
			
			a = str.compareTo(str2);
			
			if(a > 0){
				ap += 3;
			}else if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			}
			
		}
			System.out.println(ap + " " + bp);
	} main {	
		Scanner scan = new Scanner(System.in);
				
		int n, ap, bp, a;
		String str, str2;
		
		ap = 0;
		bp = 0;
		
		n = scan.nextInt();
		for(int i = 0; i < n; i++){
			str = scan.next();
			str2 = scan.next();
			
			a = str.compareTo(str2);
			
			if(a > 0){
				ap += 3;
			}else if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			}
			
		}
			System.out.println(ap + " " + bp);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n n ap ap bp bp a; a String str str str2; str2 ap = 0 ap 0 bp = 0 bp 0 n = scan.nextInt() n scan.nextInt() scan.nextInt scan for(int i = 0; i < n; i++){
			str = scan.next();
			str2 = scan.next();
			
			a = str.compareTo(str2);
			
			if(a > 0){
				ap += 3;
			}else if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			}
			
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			str = scan.next();
			str2 = scan.next();
			
			a = str.compareTo(str2);
			
			if(a > 0){
				ap += 3;
			}else if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			}
			
		} {
			str = scan.next();
			str2 = scan.next();
			
			a = str.compareTo(str2);
			
			if(a > 0){
				ap += 3;
			}else if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			}
			
		} str = scan.next() str scan.next() scan.next scan str2 = scan.next() str2 scan.next() scan.next scan a = str.compareTo(str2) a str.compareTo(str2) str.compareTo str str2 if(a > 0){
				ap += 3;
			}else if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			} a > 0 a 0 {
				ap += 3;
			} ap += 3 ap 3 if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			} a == 0 a 0 {
				ap++;
				bp++;
			} ap++ ap bp++ bp {
				bp += 3;
			} bp += 3 bp 3 System.out.println(ap + " " + bp) System.out.println System.out System System.out ap + " " + bp ap + " " + bp ap " " bp String args[] args
import java.util.Scanner;

class Main {
	public static void main(String args[]){	
		Scanner scan = new Scanner(System.in);
				
		int n, ap, bp, a;
		String str, str2;
		
		ap = 0;
		bp = 0;
		
		n = scan.nextInt();
		for(int i = 0; i < n; i++){
			str = scan.next();
			str2 = scan.next();
			
			a = str.compareTo(str2);
			
			if(a > 0){
				ap += 3;
			}else if(a == 0){
				ap++;
				bp++;
			}else{
				bp += 3;
			}
			
		}
			System.out.println(ap + " " + bp);
	}
}