import java.util.Scanner;
 
class Main{
    	public static void main(String[] args){
        	Scanner sc = new Scanner(System.in);
        	String card1,card2;
        	int cnt1 = 0,cnt2 = 0, x;
        	int y = sc.nextInt();
        	for(int i = 0; i < y; i++){
            		card1 = sc.next();
            		card2 = sc.next();
            		x = card1.compareTo(card2);
            		if(x == 0){
				cnt1++;
				cnt2++;
			}else if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		}
		}
        	System.out.println(cnt1 + " " + cnt2);
    	}
} import java.util.Scanner; Scanner java.util class Main{
    	public static void main(String[] args){
        	Scanner sc = new Scanner(System.in);
        	String card1,card2;
        	int cnt1 = 0,cnt2 = 0, x;
        	int y = sc.nextInt();
        	for(int i = 0; i < y; i++){
            		card1 = sc.next();
            		card2 = sc.next();
            		x = card1.compareTo(card2);
            		if(x == 0){
				cnt1++;
				cnt2++;
			}else if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		}
		}
        	System.out.println(cnt1 + " " + cnt2);
    	}
} Main public static void main(String[] args){
        	Scanner sc = new Scanner(System.in);
        	String card1,card2;
        	int cnt1 = 0,cnt2 = 0, x;
        	int y = sc.nextInt();
        	for(int i = 0; i < y; i++){
            		card1 = sc.next();
            		card2 = sc.next();
            		x = card1.compareTo(card2);
            		if(x == 0){
				cnt1++;
				cnt2++;
			}else if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		}
		}
        	System.out.println(cnt1 + " " + cnt2);
    	} main {
        	Scanner sc = new Scanner(System.in);
        	String card1,card2;
        	int cnt1 = 0,cnt2 = 0, x;
        	int y = sc.nextInt();
        	for(int i = 0; i < y; i++){
            		card1 = sc.next();
            		card2 = sc.next();
            		x = card1.compareTo(card2);
            		if(x == 0){
				cnt1++;
				cnt2++;
			}else if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		}
		}
        	System.out.println(cnt1 + " " + cnt2);
    	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String card1 card1 card2; card2 int cnt1 = 0 cnt1 0 cnt2 = 0 cnt2 0 x; x int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc for(int i = 0; i < y; i++){
            		card1 = sc.next();
            		card2 = sc.next();
            		x = card1.compareTo(card2);
            		if(x == 0){
				cnt1++;
				cnt2++;
			}else if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		}
		} int i = 0; int i = 0; i 0 i < y i y i++ i++ i {
            		card1 = sc.next();
            		card2 = sc.next();
            		x = card1.compareTo(card2);
            		if(x == 0){
				cnt1++;
				cnt2++;
			}else if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		}
		} {
            		card1 = sc.next();
            		card2 = sc.next();
            		x = card1.compareTo(card2);
            		if(x == 0){
				cnt1++;
				cnt2++;
			}else if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		}
		} card1 = sc.next() card1 sc.next() sc.next sc card2 = sc.next() card2 sc.next() sc.next sc x = card1.compareTo(card2) x card1.compareTo(card2) card1.compareTo card1 card2 if(x == 0){
				cnt1++;
				cnt2++;
			}else if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		} x == 0 x 0 {
				cnt1++;
				cnt2++;
			} cnt1++ cnt1 cnt2++ cnt2 if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		} x > 0 x 0 {
				cnt1 += 3;
            		} cnt1 += 3 cnt1 3 {
				cnt2 += 3;
        		} cnt2 += 3 cnt2 3 System.out.println(cnt1 + " " + cnt2) System.out.println System.out System System.out cnt1 + " " + cnt2 cnt1 + " " + cnt2 cnt1 " " cnt2 String[] args args
import java.util.Scanner;
 
class Main{
    	public static void main(String[] args){
        	Scanner sc = new Scanner(System.in);
        	String card1,card2;
        	int cnt1 = 0,cnt2 = 0, x;
        	int y = sc.nextInt();
        	for(int i = 0; i < y; i++){
            		card1 = sc.next();
            		card2 = sc.next();
            		x = card1.compareTo(card2);
            		if(x == 0){
				cnt1++;
				cnt2++;
			}else if(x > 0){
				cnt1 += 3;
            		}else{
				cnt2 += 3;
        		}
		}
        	System.out.println(cnt1 + " " + cnt2);
    	}
}