Array rearrangement - MarisaOJ: Marisa Online Judge

Array rearrangement

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ of $n$ integers. Count the number of different arrays can be obtained by rearranging elements in $A$. ### Input - The first line contains an integer $n$. - The second line contains $n$ integers $A_i$. ### Output - Print the number of different arrays, modulo $10^9+7$.. ### Constraints - $1 \le n \le 10^6$. - $1 \le A_i \le 10^9$. ### Example Input: ``` 4 1 2 1 3 ``` Output: ``` 12 ```