Erasing Game

No attempts yetTime limit1sMemory limit128 MB

Problem

Hongjun and Myungwoo play a game with sequences. Hongjun first writes down a sequence AA of NN natural numbers, chosen however he likes, and Myungwoo writes down a sequence SS of the same length in the same way.

The game runs for NN rounds. In round ii, Hongjun has to erase one number from his own sequence AA that is not greater than SiS_i. If no such number is left, Hongjun loses. If he finishes all NN rounds, Hongjun wins.

Given Myungwoo's sequence SS, count the sequences AA that let Hongjun win when he plays with an optimal strategy. Two sequences with the same numbers in a different order count as different sequences.

Input

The first line contains the length NN. (1N2001 \le N \le 200)

The ii-th of the next NN lines contains SiS_i. (1Si1091 \le S_i \le 10^9)

Output

Print the number of sequences AA that Hongjun can win with, modulo 1,000,000,007.

Hint

For N=2N = 2 and S=(1,2)S = (1, 2), the sequences AA that Hongjun can win with are (1,1)(1, 1), (1,2)(1, 2), and (2,1)(2, 1).