import java.util.Scanner;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int Hanako_Point = 0;
		int Taro_Point = 0;
		int n = sc.nextInt();

		for(int i = 0; i< n; i++){
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		}
		System.out.println(Taro_Point + " " + Hanako_Point);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int Hanako_Point = 0;
		int Taro_Point = 0;
		int n = sc.nextInt();

		for(int i = 0; i< n; i++){
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		}
		System.out.println(Taro_Point + " " + Hanako_Point);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int Hanako_Point = 0;
		int Taro_Point = 0;
		int n = sc.nextInt();

		for(int i = 0; i< n; i++){
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		}
		System.out.println(Taro_Point + " " + Hanako_Point);
	} main {
		Scanner sc = new Scanner(System.in);
		int Hanako_Point = 0;
		int Taro_Point = 0;
		int n = sc.nextInt();

		for(int i = 0; i< n; i++){
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		}
		System.out.println(Taro_Point + " " + Hanako_Point);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int Hanako_Point = 0; Hanako_Point 0 int Taro_Point = 0; Taro_Point 0 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i = 0; i< n; i++){
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		} int i = 0; int i = 0; i 0 i< n i n i++ i++ i {
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		} {
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		} String Taro_Card = sc.next(); Taro_Card sc.next() sc.next sc String Hanako_Card = sc.next(); Hanako_Card sc.next() sc.next sc if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			} Taro_Card.compareToIgnoreCase(Hanako_Card) < 0 Taro_Card.compareToIgnoreCase(Hanako_Card) Taro_Card.compareToIgnoreCase Taro_Card Hanako_Card 0 {
				Hanako_Point += 3;
			} Hanako_Point += 3 Hanako_Point 3 if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			} Taro_Card.compareToIgnoreCase(Hanako_Card) == 0 Taro_Card.compareToIgnoreCase(Hanako_Card) Taro_Card.compareToIgnoreCase Taro_Card Hanako_Card 0 {
				Taro_Point ++;
				Hanako_Point++;
			} Taro_Point ++ Taro_Point Hanako_Point++ Hanako_Point {
				Taro_Point += 3;
			} Taro_Point += 3 Taro_Point 3 System.out.println(Taro_Point + " " + Hanako_Point) System.out.println System.out System System.out Taro_Point + " " + Hanako_Point Taro_Point + " " + Hanako_Point Taro_Point " " Hanako_Point String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int Hanako_Point = 0;
		int Taro_Point = 0;
		int n = sc.nextInt();

		for(int i = 0; i< n; i++){
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		}
		System.out.println(Taro_Point + " " + Hanako_Point);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int Hanako_Point = 0;
		int Taro_Point = 0;
		int n = sc.nextInt();

		for(int i = 0; i< n; i++){
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		}
		System.out.println(Taro_Point + " " + Hanako_Point);
	}
} Main
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int Hanako_Point = 0;
		int Taro_Point = 0;
		int n = sc.nextInt();

		for(int i = 0; i< n; i++){
			String Taro_Card = sc.next();
			String Hanako_Card = sc.next();

			if(Taro_Card.compareToIgnoreCase(Hanako_Card) < 0){
				Hanako_Point += 3;
			}else if(Taro_Card.compareToIgnoreCase(Hanako_Card) == 0){
				Taro_Point ++;
				Hanako_Point++;
			}else{
				Taro_Point += 3;
			}
		}
		System.out.println(Taro_Point + " " + Hanako_Point);
	}
}
