Arrange and Count!

아직 제출이 없습니다시간 제한5초메모리 제한512 MB

문제

Alice has a sequence a_1,a_2,,a_na\_1,a\_2,\dots,a\_n. She can rearrange the sequence using the following operation any number of times:

  • Select an integer ii (1in1 \le i \le n) and change the sequence to a_i,a_i1,,a_1,a_n,a_n1,,a_i+1a\_i, a\_{i-1}, \dots, a\_1, a\_n, a\_{n-1}, \dots, a\_{i+1}.

Alice would like to know the number of different sequences can be obtained modulo (109+7)(10^9+7).

입력

The input consists of several test cases terminated by end-of-file. For each test case:

The first line contains an integer nn, the length of the sequence.

The second line contains nn integers a_1,a_2,,a_na\_1, a\_2, \dots, a\_n.

출력

For each test case, print an integer which denotes the result.

제한

  • 1n1051 \leq n \leq 10^5
  • 1a_in1 \leq a\_i \leq n
  • The sum of nn does not exceed 2×1062 \times 10^6.