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

class Main {
	/**
	 * ??\?????????????????? / ????????????????????????
	 */
	public static void main(String[] args) throws Exception {

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

		String answer = getScore(br);

		System.out.println(answer);
	}

	/**
	 * ??¨??????????????¢???????????????????????????
	 */
	private static String getScore(BufferedReader br) {

		String line;
		String allScore = ""; // ?????????????????¨??????????????¢
		int singleScore = 0; // ??????????????°???????????¢
		int outCnt = 0;
		int getEning; // ???????????°??°
		int thisEning = 1; // ?????????????????°
		int countOfRunner = 0; // ?????????????????°

		try {
			// ????????????????????°??°???????????????
			getEning = Integer.parseInt(br.readLine());

			while (!isEndLine(line = br.readLine())) {

				if (line.equals("HIT")) {

					// ???????????????????¢???????
					countOfRunner += 1;
					// ??????????????¢????¨??????????
					singleScore = getScore(countOfRunner, singleScore);
					// ??????????????°?????£??????????????§??????
					countOfRunner = chckOfRunner(countOfRunner);

				} else if (line.equals("HOMERUN")) {

					// ?????????????????§????????\??£??????????¨??????????
					singleScore = getHomerunScore(countOfRunner, singleScore);
					// ?????????????????????????????????
					countOfRunner = 0;

				} else {
					
					//??¢??????????????§????¶????
					outCnt++;
				}

				if (outCnt == 3) {

					if (getEning == thisEning) {// ?????????????????°?????§??????
						
						// ??????????????????????????????????????§??\???????????????
						allScore = createLastScoreLine(singleScore, allScore);
						return allScore;
						
					} else {
						
						allScore = createScoreLine(singleScore, allScore);
					}

					// ??¢????????????????????¨??????????????¨????????¢??????,???????????°????????????
					outCnt = 0;
					countOfRunner = 0;
					singleScore = 0;
					thisEning++;
				}
			}
			return null;
			
		} catch (IOException e) {
			
			e.printStackTrace();
			return null;
		}
	}

	/**
	 * ???????????¶???????????????
	 */
	private static boolean isEndLine(String line) {
		
		return Objects.isNull(line);
	}

	/**
	 * ?????????????????°????????\????????????????????????????????´??????????????????
	 */
	private static int chckOfRunner(int countOfRunner) {
		
		if (countOfRunner > 3) {
			countOfRunner = 3;
		}
		return countOfRunner;
	}

	/**
	 * ??????????????£?????¨??????????????¢???????????????????????????
	 */
	private static int getScore(int countOfRunner, int singleScore) {
		
		// ?????????????????°????????????????????¢???????¶????
		if (countOfRunner == 4) {
			singleScore++;
		}
		return singleScore;
	}

	/**
	 * ????????????????????£?????¨??????????????¢???????????????????????????
	 */
	private static int getHomerunScore(int countOfRunner, int singleScore) {
		
		// ?????????????????°???????¶??????????????????????????????¢????????????
		singleScore += countOfRunner + 1;
		return singleScore;
	}

	/**
	 * ???????????°???????????£?????????????????¢????????????????????????????????????
	 */
	private static String createScoreLine(int singleScore, String allScore) {

		allScore += String.valueOf(singleScore) + "\n";

		return allScore;
	}

	/**
	 * ????????????????????°???????????£????????????????????????????????¢?????????????????????
	 */
	private static String createLastScoreLine(int singleScore, String allScore) {

		allScore += String.valueOf(singleScore);

		return allScore;
	}
}

Measured memory_bytes: 24220