#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S;
    cin>>N>>S;

    string mae,ushi;
    mae = S.substr(0,N);
    ushi = S.substr(N,N);

    map<pair<string,string>,ll> mp;
    //後ろ半分の文字列(反転させる)
    for(int i=0;i<(1<<N);i++){
        string a="",b="";
        for(int j=0;j<N;j++){
            if(i>>j & 1) a += ushi[j];
            else b += ushi[j];
        }
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        auto p = make_pair(a,b);
        ++mp[p];
    }

    ll res = 0;
    for(int i=0;i<(1<<N);i++){
        string a="",b="";
        for(int j=0;j<N;j++){
            if(i>>j & 1) a += mae[j];
            else b += mae[j];
        }
        auto p = make_pair(a,b);
        res += mp[p];
    }
    cout<<res<<endl;
}

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iomanip>

using namespace std;

typedef long long ll;

const int MAXN = 18;

int n;
int LOG[1 << MAXN];

ll ans;
ll f[2][1 << MAXN][MAXN + 1];
ll g[2][1 << MAXN][MAXN + 1];

string S,s,t;

int popcount(int v)
{
	return v ? popcount(v - (v & -v)) + 1 : 0;
}

int main()
{
	cin >> n >> S;
	LOG[0] = -1;
	for (int i = 1;i < (1 << n);i++)
		LOG[i] = LOG[i >> 1] + 1;
	s = S.substr(0,n);
	reverse(S.begin(),S.end());
	t = S.substr(0,n);
	f[0][0][0] = 1;
	for (int j = 0;j <= n;j++)
	{
		memset(f[~j & 1],0,sizeof(f[~j & 1]));
		memset(g[~j & 1],0,sizeof(g[~j & 1]));
		for (int i = 0,I = 0;i < (1 << n);I = popcount(++i))
		{
			if (j > I)
				continue;
			for (int k = 0;k < n;k++)
			{
				if (f[j & 1][i][k])
				{
					for (int l = LOG[i] + 1;l < n;l++)
						if (t[l] == s[I])
							f[~j & 1][i | (1 << l)][k + (l == k)] += f[j & 1][i][k];
					if (k == LOG[i] + 1)
					{
						for (int l = k + 1;l < n;l++)
							if (t[l] == s[I])
								g[j & 1][i | (1 << l)][k + (l == k)] += f[j & 1][i][k];
					}
					if (t[k] == s[I])
					{
						int K = k + 1;
						while (K < n && (i >> K & 1))
							K++;
						int el = LOG[i] + 1 + (LOG[i] + 1 == k);
						if (K > el)
							g[j & 1][i | (1 << k)][el] += f[j & 1][i][k];
						else
							f[j & 1][i | (1 << k)][K] += f[j & 1][i][k];
					}
				}
				if (g[j & 1][i][k])
				{
					for (int l = LOG[i] + 1;l < n;l++)
						if (t[l] == s[I])
							g[j & 1][i | (1 << l)][k] += g[j & 1][i][k];
					if (t[k] == s[I])
					{
						int K = k + 1;
						while (K < n && (i >> K & 1))
							K++;
						int el = LOG[i] + 1 + (LOG[i] + 1 == k);
						if (K >= el)
							f[~j & 1][i | (1 << k)][el] += g[j & 1][i][k];
						else
							g[~j & 1][i | (1 << k)][K] += g[j & 1][i][k];
					}
				}
			}
		}
		ans += f[j & 1][(1 << n) - 1][n];
	}
	cout << ans << endl; 
	return 0;
} 