
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		String[] tarou = new String[n];
		String[] hanako = new String[n];
		int tarou_score = 0;
		int hanako_score = 0;
		for(int i=0;i<n;i++){
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		}
		
		for(int i=0;i<n;i++){
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		}
		
		System.out.println(tarou_score+" "+hanako_score);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		String[] tarou = new String[n];
		String[] hanako = new String[n];
		int tarou_score = 0;
		int hanako_score = 0;
		for(int i=0;i<n;i++){
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		}
		
		for(int i=0;i<n;i++){
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		}
		
		System.out.println(tarou_score+" "+hanako_score);
	}
} Main public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		String[] tarou = new String[n];
		String[] hanako = new String[n];
		int tarou_score = 0;
		int hanako_score = 0;
		for(int i=0;i<n;i++){
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		}
		
		for(int i=0;i<n;i++){
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		}
		
		System.out.println(tarou_score+" "+hanako_score);
	} main {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		String[] tarou = new String[n];
		String[] hanako = new String[n];
		int tarou_score = 0;
		int hanako_score = 0;
		for(int i=0;i<n;i++){
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		}
		
		for(int i=0;i<n;i++){
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		}
		
		System.out.println(tarou_score+" "+hanako_score);
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn String[] tarou = new String[n]; tarou new String[n] n String[] hanako = new String[n]; hanako new String[n] n int tarou_score = 0; tarou_score 0 int hanako_score = 0; hanako_score 0 for(int i=0;i<n;i++){
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		} {
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		} tarou[i] = stdIn.next() tarou[i] tarou i stdIn.next() stdIn.next stdIn hanako[i] = stdIn.next() hanako[i] hanako i stdIn.next() stdIn.next stdIn for(int i=0;i<n;i++){
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		} {
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		} if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			} tarou[i].compareTo(hanako[i])>0 tarou[i].compareTo(hanako[i]) tarou[i].compareTo tarou[i] tarou i hanako[i] hanako i 0 {
				tarou_score += 3;
			} tarou_score += 3 tarou_score 3 if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			} tarou[i].compareTo(hanako[i])<0 tarou[i].compareTo(hanako[i]) tarou[i].compareTo tarou[i] tarou i hanako[i] hanako i 0 {
				hanako_score += 3;
			} hanako_score += 3 hanako_score 3 {
				tarou_score += 1;
				hanako_score += 1;
			} tarou_score += 1 tarou_score 1 hanako_score += 1 hanako_score 1 System.out.println(tarou_score+" "+hanako_score) System.out.println System.out System System.out tarou_score+" "+hanako_score tarou_score+" "+hanako_score tarou_score " " hanako_score String[] args args public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		String[] tarou = new String[n];
		String[] hanako = new String[n];
		int tarou_score = 0;
		int hanako_score = 0;
		for(int i=0;i<n;i++){
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		}
		
		for(int i=0;i<n;i++){
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		}
		
		System.out.println(tarou_score+" "+hanako_score);
	}
} public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		String[] tarou = new String[n];
		String[] hanako = new String[n];
		int tarou_score = 0;
		int hanako_score = 0;
		for(int i=0;i<n;i++){
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		}
		
		for(int i=0;i<n;i++){
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		}
		
		System.out.println(tarou_score+" "+hanako_score);
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		String[] tarou = new String[n];
		String[] hanako = new String[n];
		int tarou_score = 0;
		int hanako_score = 0;
		for(int i=0;i<n;i++){
			tarou[i] = stdIn.next();
			hanako[i] = stdIn.next();
		}
		
		for(int i=0;i<n;i++){
			if(tarou[i].compareTo(hanako[i])>0){
				tarou_score += 3;
			}
			else if(tarou[i].compareTo(hanako[i])<0){
				hanako_score += 3;
			}
			else{
				tarou_score += 1;
				hanako_score += 1;
			}
		}
		
		System.out.println(tarou_score+" "+hanako_score);
	}
}