Rebound Sequences

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

문제

An integer sequence aa is rebound sequence if there are three integers ii, jj, kk (1i<j<kN1 \le i < j < k \le N) satisfying a_i>a_k>a_ja\_i > a\_k > a\_j. You are given an integer sequence ss. Your task is to count the number of rebound sequences that can be obtained by permuting the elements of ss.

입력

The input consists of a single test case in the format below.

NN

s_1s\_1 s_2s\_2 \dots s_Ns\_N

The first line contains a single integer NN (1N2001 \le N \le 200). The second line contains NN integers s_is\_i (1s_iN1 \le s\_i \le N), which is the ii-th element of ss.

출력

Output the number of rebound sequences that can be obtained by permuting the elements of ss modulo 109+710^9 + 7.