Codeforces Round 614 (Div. 1) |
---|
Finished |
Back in time, the seven-year-old Nora used to play lots of games with her creation ROBO_Head-02, both to have fun and enhance his abilities.
One day, Nora's adoptive father, Phoenix Wyle, brought Nora $$$n$$$ boxes of toys. Before unpacking, Nora decided to make a fun game for ROBO.
She labelled all $$$n$$$ boxes with $$$n$$$ distinct integers $$$a_1, a_2, \ldots, a_n$$$ and asked ROBO to do the following action several (possibly zero) times:
Being amused after nine different tries of the game, Nora asked ROBO to calculate the number of possible different piles having the largest amount of boxes in them. Two piles are considered different if there exists a position where those two piles have different boxes.
Since ROBO was still in his infant stages, and Nora was still too young to concentrate for a long time, both fell asleep before finding the final answer. Can you help them?
As the number of such piles can be very large, you should print the answer modulo $$$10^9 + 7$$$.
The first line contains an integer $$$n$$$ ($$$3 \le n \le 60$$$), denoting the number of boxes.
The second line contains $$$n$$$ distinct integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 60$$$), where $$$a_i$$$ is the label of the $$$i$$$-th box.
Print the number of distinct piles having the maximum number of boxes that ROBO_Head can have, modulo $$$10^9 + 7$$$.
3 2 6 8
2
5 2 3 4 9 12
4
4 5 7 2 9
1
Let's illustrate the box pile as a sequence $$$b$$$, with the pile's bottommost box being at the leftmost position.
In the first example, there are $$$2$$$ distinct piles possible:
In the second example, there are $$$4$$$ distinct piles possible:
In the third sequence, ROBO can do nothing at all. Therefore, there is only $$$1$$$ valid pile, and that pile is empty.
Name |
---|