AtCoder Beginner Contest 089
C
March
AtCoder
⌀ 642
原题
← BD →
翻译中…

Problem Statement

翻译中…

There are $N$ people. The name of the $i$-th person is $S_i$.

翻译中…

We would like to choose three people so that the following conditions are met:

翻译中…
  • The name of every chosen person begins with M, A, R, C or H.
  • There are no multiple people whose names begin with the same letter.
翻译中…

How many such ways are there to choose three people, disregarding order?

翻译中…

Note that the answer may not fit into a $32$-bit integer type.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^5$
  • $S_i$ consists of uppercase English letters.
  • $1 \leq |S_i| \leq 10$
  • $S_i \neq S_j (i \neq j)$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
S_1
:
S_N

翻译中…

Output

翻译中…

If there are $x$ ways to choose three people so that the given conditions are met, print $x$.

翻译中…

样例

Input #1
5
MASHIKE
RUMOI
OBIRA
HABORO
HOROKANAI
Output #1
2
We can choose three people with the following names: - `MASHIKE`, `RUMOI`, `HABORO` - `MASHIKE`, `RUMOI`, `HOROKANAI` Thus, we have two ways.
Input #2
4
ZZ
ZZZ
Z
ZZZZZZZZZZ
Output #2
0
Note that there may be no ways to choose three people so that the given conditions are met.
Input #3
5
CHOKUDAI
RNG
MAKOTO
AOKI
RINGO
Output #3
7
题目信息
题号
abc089_c
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。