import java.util.Scanner;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int tarou_point = 0;
		int hanako_point = 0;
		
		for (int i = 0; i < n; i++){
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		}
		
		System.out.println(tarou_point + " " + hanako_point);
	}
} import java.util.Scanner; Scanner java.util import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int tarou_point = 0;
		int hanako_point = 0;
		
		for (int i = 0; i < n; i++){
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		}
		
		System.out.println(tarou_point + " " + hanako_point);
	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int tarou_point = 0;
		int hanako_point = 0;
		
		for (int i = 0; i < n; i++){
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		}
		
		System.out.println(tarou_point + " " + hanako_point);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int tarou_point = 0;
		int hanako_point = 0;
		
		for (int i = 0; i < n; i++){
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		}
		
		System.out.println(tarou_point + " " + hanako_point);
	} 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 tarou_point = 0; tarou_point 0 int hanako_point = 0; hanako_point 0 for (int i = 0; i < n; i++){
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		} {
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		} String []words = sc.nextLine().split(" "); words sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " char tarou[] = words[0].toCharArray(); tarou words[0].toCharArray() words[0].toCharArray words[0] words 0 char hanako[] = words[1].toCharArray(); hanako words[1].toCharArray() words[1].toCharArray words[1] words 1 int flag = 2; flag 2 int length = hanako.length; length hanako.length hanako hanako.length if (tarou.length < hanako.length){
		        length = tarou.length;
		    } tarou.length < hanako.length tarou.length tarou tarou.length hanako.length hanako hanako.length {
		        length = tarou.length;
		    } length = tarou.length length tarou.length tarou tarou.length for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    } int l = 0; int l = 0; l 0 l < length l length l++ l++ l {
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    } {
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    } if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        } tarou[l] < hanako[l] tarou[l] tarou l hanako[l] hanako l {
		            flag = 0;
		            break;
		        } flag = 0 flag 0 break; if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        } tarou[l] > hanako[l] tarou[l] tarou l hanako[l] hanako l {
		            flag = 1;
		            break;
		        } flag = 1 flag 1 break; if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    } flag == 0 flag 0 {
		        hanako_point += 3;
		    } hanako_point += 3 hanako_point 3 if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    } flag == 1 flag 1 {
		        tarou_point += 3;
		    } tarou_point += 3 tarou_point 3 {
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    } if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        } tarou.length > hanako.length tarou.length tarou tarou.length hanako.length hanako hanako.length {
		            tarou_point += 3;
		        } tarou_point += 3 tarou_point 3 if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        } tarou.length < hanako.length tarou.length tarou tarou.length hanako.length hanako hanako.length {
		            hanako_point += 3;
		        } hanako_point += 3 hanako_point 3 {
		            hanako_point += 1;
		            tarou_point  += 1;
		        } hanako_point += 1 hanako_point 1 tarou_point  += 1 tarou_point 1 System.out.println(tarou_point + " " + hanako_point) System.out.println System.out System System.out tarou_point + " " + hanako_point tarou_point + " " + hanako_point tarou_point " " hanako_point String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int tarou_point = 0;
		int hanako_point = 0;
		
		for (int i = 0; i < n; i++){
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		}
		
		System.out.println(tarou_point + " " + hanako_point);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int tarou_point = 0;
		int hanako_point = 0;
		
		for (int i = 0; i < n; i++){
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		}
		
		System.out.println(tarou_point + " " + hanako_point);
	}
} Main
import java.util.Scanner;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int tarou_point = 0;
		int hanako_point = 0;
		
		for (int i = 0; i < n; i++){
		    String []words = sc.nextLine().split(" ");
		    char tarou[] = words[0].toCharArray();
		    char hanako[] = words[1].toCharArray();
		    int flag = 2;
		    
		    int length = hanako.length;
		    
		    if (tarou.length < hanako.length){
		        length = tarou.length;
		    }
		    
		    for (int l = 0; l < length; l++){
		        if (tarou[l] < hanako[l]){
		            flag = 0;
		            break;
		        }else if(tarou[l] > hanako[l]){
		            flag = 1;
		            break;
		        }
		    }
		    
		    if (flag == 0){
		        hanako_point += 3;
		    }else if(flag == 1){
		        tarou_point += 3;
		    }else{
		        if (tarou.length > hanako.length){
		            tarou_point += 3;
		        }else if (tarou.length < hanako.length){
		            hanako_point += 3;
		        } else{
		            hanako_point += 1;
		            tarou_point  += 1;
		        }
		        
		    }
		}
		
		System.out.println(tarou_point + " " + hanako_point);
	}
}
