import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int i = 0 , taroPo = 0 , hanakoPo = 0 ;
		while(i != n){
			i++;
			String taro = scan.next();
			String hanako = scan.next();
			
			if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			}
		}
		
		System.out.println(taroPo + " " + hanakoPo);
		
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int i = 0 , taroPo = 0 , hanakoPo = 0 ;
		while(i != n){
			i++;
			String taro = scan.next();
			String hanako = scan.next();
			
			if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			}
		}
		
		System.out.println(taroPo + " " + hanakoPo);
		
	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int i = 0 , taroPo = 0 , hanakoPo = 0 ;
		while(i != n){
			i++;
			String taro = scan.next();
			String hanako = scan.next();
			
			if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			}
		}
		
		System.out.println(taroPo + " " + hanakoPo);
		
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int i = 0 , taroPo = 0 , hanakoPo = 0 ;
		while(i != n){
			i++;
			String taro = scan.next();
			String hanako = scan.next();
			
			if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			}
		}
		
		System.out.println(taroPo + " " + hanakoPo);
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int i = 0 i 0 taroPo = 0 taroPo 0 hanakoPo = 0 ; hanakoPo 0 while(i != n){
			i++;
			String taro = scan.next();
			String hanako = scan.next();
			
			if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			}
		} i != n i n {
			i++;
			String taro = scan.next();
			String hanako = scan.next();
			
			if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			}
		} i++ i String taro = scan.next(); taro scan.next() scan.next scan String hanako = scan.next(); hanako scan.next() scan.next scan if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			} taro.compareTo(hanako) < 0 taro.compareTo(hanako) taro.compareTo taro hanako 0 hanakoPo += 3 hanakoPo 3 if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			} taro.compareTo(hanako) > 0 taro.compareTo(hanako) taro.compareTo taro hanako 0 taroPo += 3 taroPo 3 { 
				taroPo ++;
				hanakoPo ++;
			} taroPo ++ taroPo hanakoPo ++ hanakoPo System.out.println(taroPo + " " + hanakoPo) System.out.println System.out System System.out taroPo + " " + hanakoPo taroPo + " " + hanakoPo taroPo " " hanakoPo String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int i = 0 , taroPo = 0 , hanakoPo = 0 ;
		while(i != n){
			i++;
			String taro = scan.next();
			String hanako = scan.next();
			
			if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			}
		}
		
		System.out.println(taroPo + " " + hanakoPo);
		
	}

} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int i = 0 , taroPo = 0 , hanakoPo = 0 ;
		while(i != n){
			i++;
			String taro = scan.next();
			String hanako = scan.next();
			
			if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			}
		}
		
		System.out.println(taroPo + " " + hanakoPo);
		
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int i = 0 , taroPo = 0 , hanakoPo = 0 ;
		while(i != n){
			i++;
			String taro = scan.next();
			String hanako = scan.next();
			
			if(taro.compareTo(hanako) < 0) hanakoPo += 3;
			else if(taro.compareTo(hanako) > 0) taroPo += 3;
			else { 
				taroPo ++;
				hanakoPo ++;
			}
		}
		
		System.out.println(taroPo + " " + hanakoPo);
		
	}

}