Rebound Sequences
시간 제한2초메모리 제한512 MB
다중집합을 순열로 배열할 때 i<j<k이고 a_i > a_k > a_j인 세 원소가 없는 배열의 수를 1e9+7로 나눈 나머지를 구한다.
문제
An integer sequence is rebound sequence if there are three integers , , () satisfying . You are given an integer sequence . Your task is to count the number of rebound sequences that can be obtained by permuting the elements of .
입력
The input consists of a single test case in the format below.
The first line contains a single integer (). The second line contains integers (), which is the -th element of .
출력
Output the number of rebound sequences that can be obtained by permuting the elements of modulo .