import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();

		int tp = 0;
		int hp = 0;

		for(int i=0;i<x;i++) {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		}

		System.out.println(tp + " " + hp);

		sc.close();
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();

		int tp = 0;
		int hp = 0;

		for(int i=0;i<x;i++) {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		}

		System.out.println(tp + " " + hp);

		sc.close();
	}
} Main public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();

		int tp = 0;
		int hp = 0;

		for(int i=0;i<x;i++) {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		}

		System.out.println(tp + " " + hp);

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();

		int tp = 0;
		int hp = 0;

		for(int i=0;i<x;i++) {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		}

		System.out.println(tp + " " + hp);

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int tp = 0; tp 0 int hp = 0; hp 0 for(int i=0;i<x;i++) {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		} int i=0; int i=0; i 0 i<x i x i++ i++ i {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		} {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		} String t = sc.next(); t sc.next() sc.next sc String h = sc.next(); h sc.next() sc.next sc if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			} t.equals(h) t.equals t h {
				tp += 1;
				hp += 1;
			} tp += 1 tp 1 hp += 1 hp 1 if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			} t.compareTo(h) > 0 t.compareTo(h) t.compareTo t h 0 {
				tp += 3;
			} tp += 3 tp 3 {
				hp += 3;
			} hp += 3 hp 3 System.out.println(tp + " " + hp) System.out.println System.out System System.out tp + " " + hp tp + " " + hp tp " " hp sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();

		int tp = 0;
		int hp = 0;

		for(int i=0;i<x;i++) {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		}

		System.out.println(tp + " " + hp);

		sc.close();
	}
} public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();

		int tp = 0;
		int hp = 0;

		for(int i=0;i<x;i++) {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		}

		System.out.println(tp + " " + hp);

		sc.close();
	}
} Main
import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();

		int tp = 0;
		int hp = 0;

		for(int i=0;i<x;i++) {
			String t = sc.next();
			String h = sc.next();

			if(t.equals(h)) {
				tp += 1;
				hp += 1;
			}else if(t.compareTo(h) > 0) {
				tp += 3;
			}else {
				hp += 3;
			}
		}

		System.out.println(tp + " " + hp);

		sc.close();
	}
}
