import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int tarouPoint = 0;
		int hanakoPoint = 0;
		int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		}
		System.out.println(tarouPoint + " " + hanakoPoint);
	}
} import java.io.InputStreamReader; InputStreamReader java.io import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int tarouPoint = 0;
		int hanakoPoint = 0;
		int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		}
		System.out.println(tarouPoint + " " + hanakoPoint);
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int tarouPoint = 0;
		int hanakoPoint = 0;
		int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		}
		System.out.println(tarouPoint + " " + hanakoPoint);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int tarouPoint = 0;
		int hanakoPoint = 0;
		int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		}
		System.out.println(tarouPoint + " " + hanakoPoint);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int tarouPoint = 0; tarouPoint 0 int hanakoPoint = 0; hanakoPoint 0 int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for (int i = 0; i < n; i++) {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		} {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		} String[] cards = br.readLine().split(" "); cards br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int j = cards[0].compareTo(cards[1]); j cards[0].compareTo(cards[1]) cards[0].compareTo cards[0] cards 0 cards[1] cards 1 if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			} j < 0 j 0 hanakoPoint += 3 hanakoPoint 3 if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			} 0 < j 0 j tarouPoint += 3 tarouPoint 3 {
				tarouPoint++;
				hanakoPoint++;
			} tarouPoint++ tarouPoint hanakoPoint++ hanakoPoint System.out.println(tarouPoint + " " + hanakoPoint) System.out.println System.out System System.out tarouPoint + " " + hanakoPoint tarouPoint + " " + hanakoPoint tarouPoint " " hanakoPoint String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int tarouPoint = 0;
		int hanakoPoint = 0;
		int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		}
		System.out.println(tarouPoint + " " + hanakoPoint);
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int tarouPoint = 0;
		int hanakoPoint = 0;
		int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		}
		System.out.println(tarouPoint + " " + hanakoPoint);
	}
} Main
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int tarouPoint = 0;
		int hanakoPoint = 0;
		int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			String[] cards = br.readLine().split(" ");
			int j = cards[0].compareTo(cards[1]);
			if (j < 0) hanakoPoint += 3;
			else if (0 < j) tarouPoint += 3;
			else {
				tarouPoint++;
				hanakoPoint++;
			}
		}
		System.out.println(tarouPoint + " " + hanakoPoint);
	}
}