#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string> 
#include <iomanip>
#include <list>
#include <random>
#include <numeric> //iota - iota(v.begin(), v.end(), x) x, x + 1, x + 2...

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef int INT;
#define int ll
#define mmin(a, b) a = min(a, b)
#define mmax(a, b) a = max(a, b)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end()
#define sz(a) ((int)(a.size()))
#define x first
#define y second
#define watch(x) cout << (#x) << " = " << x << endl;
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

/*
tuple<int, string> f() {
return {485, "Hello"};
}
int a;
string b;
tie(a, b) = f();
*/

const double PI = 2 * acos(0.0), eps = 1e-8;
const int oo = 1000000000000000000;

template<class T>
void show(const vector<T> &a) {
	cout << sz(a) << endl;
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const ll M = 998244353;

ll MOD(ll a) {
	if (a >= 0) return a >= M ? a % M : a;
	if (a <= -M) a %= M;
	return a ? a + M : a;
}

/*______________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
______________________________________________________________________________________________________________________________*/

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int n;
	string s;
	cin >> n >> s;
	vector <int> p(2 * n);
	for (int i = 0; i < 2 * n; i++)
		p[i] = s[i] - 'a' + 1;
	int raz = 1LL << n;
	int st = 31;
	map <pair <int, int>, int> mp, mp2;
	for (int i = 0; i < raz; i++)
	{
		int mask = i;
		int hs = 0, step = 1, ps = 0;
		vector <int> d;
		for (int j = 0; j < n; j++)
		{
			if (mask & 1)
			{
				hs = hs + p[j] * step;
				step *= st;
			}
			else
			{
				d.push_back(j);
			}
			mask >>= 1;
		}
		step = 1;
		if (d.size() != 0)
		for (int j = d.size() - 1; j >= 0; j--)
		{
			ps = ps + p[d[j]] * step;
			step *= st;
		}

		mp[{hs, ps}]++;
	}
	for (int i = 0; i < raz; i++)
	{
		int mask = i;
		int hs = 0, step = 1, ps = 0;
		vector <int> d;
		for (int j = n; j < 2 * n; j++)
		{
			if (mask & 1)
			{
				hs = hs + p[j] * step;
				step *= st;
			}
			else
			{
				d.push_back(j);
			}
			mask >>= 1;
		}
		step = 1;
		if (d.size() != 0)
		for (int j = d.size() - 1; j >= 0; j--)
		{
			ps = ps + p[d[j]] * step;
			step *= st;
		}

		mp2[{ps, hs}]++;
	}
	int sum = 0;
	for (auto x : mp)
	{
		sum += x.second*mp2[x.first];
	}
	cout << sum;
}

Measured memory_bytes: 49920