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 n = Integer.parseInt(br.readLine());
        int taroScore=0,hanakoScore=0;
        for(int i=0;i<n;i++){
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	}
        System.out.println(taroScore + " " + hanakoScore);
    }
} 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 n = Integer.parseInt(br.readLine());
        int taroScore=0,hanakoScore=0;
        for(int i=0;i<n;i++){
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	}
        System.out.println(taroScore + " " + hanakoScore);
    }
} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taroScore=0,hanakoScore=0;
        for(int i=0;i<n;i++){
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	}
        System.out.println(taroScore + " " + hanakoScore);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taroScore=0,hanakoScore=0;
        for(int i=0;i<n;i++){
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	}
        System.out.println(taroScore + " " + hanakoScore);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int taroScore=0 taroScore 0 hanakoScore=0; hanakoScore 0 for(int i=0;i<n;i++){
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	} int i=0; int i=0; i 0 i<n i n i++ i++ i {
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	} {
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	} String[] str  = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int compare = str[0].compareTo(str[1]); compare str[0].compareTo(str[1]) str[0].compareTo str[0] str 0 str[1] str 1 if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	} compare > 0 compare 0 {
        		taroScore += 3;
        	} taroScore += 3 taroScore 3 if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	} compare==0 compare 0 {
        		taroScore++;
        		hanakoScore++;
        	} taroScore++ taroScore hanakoScore++ hanakoScore {
        		hanakoScore +=3;
        	} hanakoScore +=3 hanakoScore 3 System.out.println(taroScore + " " + hanakoScore) System.out.println System.out System System.out taroScore + " " + hanakoScore taroScore + " " + hanakoScore taroScore " " hanakoScore String[] args args public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taroScore=0,hanakoScore=0;
        for(int i=0;i<n;i++){
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	}
        System.out.println(taroScore + " " + hanakoScore);
    }
} public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taroScore=0,hanakoScore=0;
        for(int i=0;i<n;i++){
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	}
        System.out.println(taroScore + " " + hanakoScore);
    }
} 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 n = Integer.parseInt(br.readLine());
        int taroScore=0,hanakoScore=0;
        for(int i=0;i<n;i++){
        	String[] str  = br.readLine().split(" ");
        	int compare = str[0].compareTo(str[1]);
        	if(compare > 0){
        		taroScore += 3;
        	}else if(compare==0){
        		taroScore++;
        		hanakoScore++;
        	}else{
        		hanakoScore +=3;
        	}
    	}
        System.out.println(taroScore + " " + hanakoScore);
    }
}