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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int t = 0;
		int h = 0;
		String x = "";
		try {
			x = in.readLine();
			int n = Integer.parseInt(x);
			
			for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			}
			System.out.println(t + " " + h);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int t = 0;
		int h = 0;
		String x = "";
		try {
			x = in.readLine();
			int n = Integer.parseInt(x);
			
			for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			}
			System.out.println(t + " " + h);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} Main public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int t = 0;
		int h = 0;
		String x = "";
		try {
			x = in.readLine();
			int n = Integer.parseInt(x);
			
			for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			}
			System.out.println(t + " " + h);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int t = 0;
		int h = 0;
		String x = "";
		try {
			x = in.readLine();
			int n = Integer.parseInt(x);
			
			for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			}
			System.out.println(t + " " + h);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int t = 0; t 0 int h = 0; h 0 String x = ""; x "" try {
			x = in.readLine();
			int n = Integer.parseInt(x);
			
			for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			}
			System.out.println(t + " " + h);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} NumberFormatException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} IOException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			x = in.readLine();
			int n = Integer.parseInt(x);
			
			for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			}
			System.out.println(t + " " + h);
		} x = in.readLine() x in.readLine() in.readLine in int n = Integer.parseInt(x); n Integer.parseInt(x) Integer.parseInt Integer x for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			} {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			} String[] words = in.readLine().split(" "); words in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int judge = words[0].compareTo(words[1]); judge words[0].compareTo(words[1]) words[0].compareTo words[0] words 0 words[1] words 1 if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				} judge < 0 judge 0 {
					h = h + 3;
				} h = h + 3 h h + 3 h 3 if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				} judge == 0 judge 0 {
					t++;
					h++;
				} t++ t h++ h {
					t = t + 3;
				} t = t + 3 t t + 3 t 3 System.out.println(t + " " + h) System.out.println System.out System System.out t + " " + h t + " " + h t " " h String[] args args public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int t = 0;
		int h = 0;
		String x = "";
		try {
			x = in.readLine();
			int n = Integer.parseInt(x);
			
			for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			}
			System.out.println(t + " " + h);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int t = 0;
		int h = 0;
		String x = "";
		try {
			x = in.readLine();
			int n = Integer.parseInt(x);
			
			for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			}
			System.out.println(t + " " + h);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int t = 0;
		int h = 0;
		String x = "";
		try {
			x = in.readLine();
			int n = Integer.parseInt(x);
			
			for (int i = 0; i < n; i++) {
				String[] words = in.readLine().split(" ");
				
				int judge = words[0].compareTo(words[1]);
				if (judge < 0) {
					h = h + 3;
				} else if (judge == 0) {
					t++;
					h++;
				} else {
					t = t + 3;
				}
			}
			System.out.println(t + " " + h);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}