Problem:
Score : 2000 points

Problem Statement

Snuke received an integer sequence a of length 2N-1.

He arbitrarily permuted the elements in a, then used it to construct a new integer sequence b of length N, as follows:

b_1 = the median of (a_1)

b_2 = the median of (a_1, a_2, a_3)

b_3 = the median of (a_1, a_2, a_3, a_4, a_5)

:

b_N = the median of (a_1, a_2, a_3, ..., a_{2N-1})

How many different sequences can be obtained as b? Find the count modulo 10^{9} + 7.

Constraints

1 ≤ N ≤ 50

1 ≤ a_i ≤ 2N-1

a_i are integers.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_{2N-1}

Output

Print the answer.

Sample Input 1

2
1 3 2

Sample Output 1

3

There are three sequences that can be obtained as b: (1,2), (2,2) and (3,2). Each of these can be constructed from (1,2,3), (2,1,3) and (3,1,2), respectively.

Sample Input 2

4
1 3 2 3 2 4 3

Sample Output 2

16

Sample Input 3

15
1 5 9 11 1 19 17 18 20 1 14 3 3 8 19 15 16 29 10 2 4 13 6 12 7 15 16 1 1

Sample Output 3

911828634

Print the count modulo 10^{9} + 7.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;
inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}
int mpow(int n,int m){
    int ret=1;
    while(m){
        if(m&1)ret=ret*n%mod;
        n=n*n%mod;
        m>>=1;
    }
    return ret;
}
const int FACT_SIZE=1111111;
int fact[FACT_SIZE];
int inv[FACT_SIZE];
struct fact_exec{
    fact_exec(){
        fact[0]=1;
        for(int i=1;i<FACT_SIZE;i++)fact[i]=fact[i-1]*i%mod;
        inv[FACT_SIZE-1]=mpow(fact[FACT_SIZE-1],mod-2);
        for(int i=FACT_SIZE-2;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
    }
}factexec;
int nCk(int n,int k){
    if(n<0|k<0||k>n)return 0;
    return fact[n]*inv[k]%mod*inv[n-k]%mod;
}
int nPk(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*inv[n-k]%mod;
}


int N;
int A[111];

int dp[111][111][111];

signed main(){
    cin>>N;
    rep(i,2*N-1)cin>>A[i];
    sort(A,A+2*N-1);

    dp[0][N-1][N-1]=1;

    for(int x=0;x<N-1;x++){
        for(int i=2*N-1;i>=0;i--){
            int j=N-1;
            for(int k=2*N-1;k>=0;k--){
                int l=N-1;

                add(dp[x+1][i][k],dp[x][i][k]);
                for(int m=l-1;m<k;m++)add(dp[x+1][i+1][m],dp[x][i][k]);
                for(int m=j-1;m<k;m++)add(dp[x+1][m][k+1],dp[x][i][k]);
            }
        }
    }

    int ans=0;
    rep(i,2*N)rep(j,2*N)add(ans,dp[N-1][i][j]);
    cout<<ans<<endl;
    return 0;
}