Time Limit: 1000ms
Memory Limit: 65536kb
DescriptionCaspar has n diamonds, and each of them has a certain value. He decides to choose some of them to form two groups, one for his girlfriend and the other for his another female friend. To make sure that his girlfriend would be satisfied, Caspar must promise that the least valuable diamond he gives to his girlfriend is more valuable than any of the diamond that the other female friend receives. Besides that, his girlfriend demands that if a diamond is given to one person, all the diamonds of the same value should be given to the person too. Would you help Caspar to calculate the number of the solutions?
InputThere are multiple test cases. In each test case, the first line contains an integer n(1<=n<=10000), indicating the number of the diamonds. The following line contains n positive integers, which represent the value of each diamond.
OutputFor each test case, please print an integer M as the number of the solutions. Notice that M may be very large, so you just have to print M%100007.
5 1 1 2 2 3