#P1866. 编号
编号
Description
Taro has rabbits. To make them easier to identify, Taro will assign them numbers. The rabbits expressed their preferences: each rabbit wants an integer between and (it can be or ). Of course, the numbers assigned to different rabbits must be distinct. Now Taro wants to know how many ways there are to assign the numbers.
You only need to output the answer modulo . If this is impossible, output .
Input Format
The first line contains an integer . The second line contains integers .
Output Format
Print a single integer, the total number of ways.
2
5 8
35
Hint
Constraints
For all testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号