Hide

Problem H
quality check

\includegraphics[width=1.5\textwidth ]{quality.png} as always, the judges guarantee the quality of this year“s april fools contest.

this is done by carefully reading through the problems to ensure that there are no granmmar mistakes or $L^AT_EX$ formatting i$^ss$u$_e$s.

additionally, the judges try to solve the problems by submitting them on cattis.

each of the N judges submits exactly once, but depending on when they submit, the submissions will appear in different orders in the judging queue.

given the N judges who submitted a solution to a problem, calculate the number of possible ways the judging queue could have looked like.

Output

the first line of contains a single integer N (1 <= N <= (2$\backslash $cdot5){5}).

on each of the following N lines, there exist a name of a judge that submitted once on hte problem,.,

each name consists of english characters a-z, they could also be capitalized. there are in total at most (2$\backslash $cdot5){6} characters.

Scoring

output number of possible ways the judging queue could have looked like, modulo (2$\backslash $ cdot5){9+7}.

Sample Input 1 Sample Output 1
4
Harry
Joshua
Nils
Olle
24
Sample Input 2 Sample Output 2
2
Joshua
Harry
2

Please log in to submit a solution to this problem

Log in