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

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		// ???????????°??\???
		String game_times = input.readLine();

		int game_num = Integer.parseInt(game_times);

		// ????????¨???????????????
		int taro_point = 0;

		// ????????¨?????±?????????
		int hanako_point = 0;

		// ??????????????°????????????????????°?????°?????????
		for (int match_spot = 0; match_spot < game_num; match_spot++) {

			String two_person_card = input.readLine();

			// ???????????§?????????????????????????????±????????\???
			String[] cards_array = two_person_card.split(" ");

			String taro_card = cards_array[0];

			String hanako_card = cards_array[1];

			// ????????????????????¨??±?????????????????????????????????????????????????????????????´¢
			if (taro_card.compareToIgnoreCase(hanako_card) > 0) {

				taro_point += 3;

			} else if (taro_card.compareToIgnoreCase(hanako_card) < 0) {

				hanako_point += 3;

				// ??????????????????
			} else {

				taro_point += 1;

				hanako_point += 1;
			}
		}

		System.out.println(taro_point + " " + hanako_point);

	}

}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz