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

typedef long long ll;
const int maxn=2*(18+2);
int n;
char s[maxn],t[maxn];
vector<int> a,b;
ll ans;

void dfs(int pos){
	if(pos>=n){
		static int dp[20][20];
		for(int i=0;i<=a.size();++i)
			for(int j=0;j<=b.size();++j)
				dp[i][j]=0;
		dp[0][0]=1;
		for(int i=0;i<=a.size();++i)
			for(int j=0;j<=b.size();++j){
				if(i<a.size()&&t[i+j]==a[i])
					dp[i+1][j]+=dp[i][j];
				if(j<b.size()&&t[i+j]==b[j])
					dp[i][j+1]+=dp[i][j];
			}
		ans+=dp[a.size()][b.size()];
		return;
	}
	a.push_back(s[pos]);
	dfs(pos+1);
	a.pop_back();
	b.push_back(s[pos]);
	dfs(pos+1);
	b.pop_back();
}

int main(){
	cin>>n;
	cin>>s;
	for(int i=0;i<n;++i)
		t[i]=s[2*n-1-i];
	dfs(0);
	cout<<ans<<endl;
	return 0;
}
### Prompt

In cpp, your task is to solve the following problem:

You are given a string S of length 2N consisting of lowercase English letters.

There are 2^{2N} ways to color each character in S red or blue. Among these ways, how many satisfy the following condition?

* The string obtained by reading the characters painted red from left to right is equal to the string obtained by reading the characters painted blue from right to left.

Constraints

* 1 \leq N \leq 18
* The length of S is 2N.
* S consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:


N
S


Output

Print the number of ways to paint the string that satisfy the condition.

Examples

Input

4
cabaacba


Output

4


Input

11
mippiisssisssiipsspiim


Output

504


Input

4
abcdefgh


Output

0


Input

18
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


Output

9075135300

### Response

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

typedef long long ll;
const int maxn=2*(18+2);
int n;
char s[maxn],t[maxn];
vector<int> a,b;
ll ans;

void dfs(int pos){
	if(pos>=n){
		static int dp[20][20];
		for(int i=0;i<=a.size();++i)
			for(int j=0;j<=b.size();++j)
				dp[i][j]=0;
		dp[0][0]=1;
		for(int i=0;i<=a.size();++i)
			for(int j=0;j<=b.size();++j){
				if(i<a.size()&&t[i+j]==a[i])
					dp[i+1][j]+=dp[i][j];
				if(j<b.size()&&t[i+j]==b[j])
					dp[i][j+1]+=dp[i][j];
			}
		ans+=dp[a.size()][b.size()];
		return;
	}
	a.push_back(s[pos]);
	dfs(pos+1);
	a.pop_back();
	b.push_back(s[pos]);
	dfs(pos+1);
	b.pop_back();
}

int main(){
	cin>>n;
	cin>>s;
	for(int i=0;i<n;++i)
		t[i]=s[2*n-1-i];
	dfs(0);
	cout<<ans<<endl;
	return 0;
}
```