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

int main()
{
  int n;
  scanf("%d",&n);
  static char s[40];
  scanf("%s",s);
  long long ans=0ll;
  long long dp[40][40];
  for(int I=0;I<(1<<n);I++){
    char r[40],b[40];
    int nr=0,nb=0;
    for(int i=0;i<n;i++){
      if((I>>i)&1){
	r[nr++]=s[i];
      }
      else{
	b[nb++]=s[i];
      }
    }
    dp[0][0]=1ll;
    for(int i=0;i<=nr;i++){
      for(int j=(i==0?1:0);j<=nb;j++){
	int k=2*n-i-j;
	dp[i][j]=(i>0&&s[k]==r[i-1]?dp[i-1][j]:0)+(j>0&&s[k]==b[j-1]?dp[i][j-1]:0);
      }
    }
    ans+=dp[nr][nb];
  }
  printf("%lld\n",ans);
  return 0;
}

### Prompt

Please formulate a cpp solution to 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;

int main()
{
  int n;
  scanf("%d",&n);
  static char s[40];
  scanf("%s",s);
  long long ans=0ll;
  long long dp[40][40];
  for(int I=0;I<(1<<n);I++){
    char r[40],b[40];
    int nr=0,nb=0;
    for(int i=0;i<n;i++){
      if((I>>i)&1){
	r[nr++]=s[i];
      }
      else{
	b[nb++]=s[i];
      }
    }
    dp[0][0]=1ll;
    for(int i=0;i<=nr;i++){
      for(int j=(i==0?1:0);j<=nb;j++){
	int k=2*n-i-j;
	dp[i][j]=(i>0&&s[k]==r[i-1]?dp[i-1][j]:0)+(j>0&&s[k]==b[j-1]?dp[i][j-1]:0);
      }
    }
    ans+=dp[nr][nb];
  }
  printf("%lld\n",ans);
  return 0;
}

```