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

struct PolynomialHash {
	static const int NumMods = 5;
	static const unsigned Mods[NumMods];
	typedef unsigned long long ull;
	struct Hash {
		unsigned hs[NumMods];
		Hash() { for (int k = 0; k < NumMods; ++ k) hs[k] = 0; }
		explicit Hash(unsigned x) {
			if (x < Mods[NumMods - 1]) {
				for (int k = 0; k < NumMods; ++ k) hs[k] = x;
			} else {
				for (int k = 0; k < NumMods; ++ k) hs[k] = x % Mods[k];
			}
		}
		bool operator==(const Hash &that) const {
			bool res = true;
			for (int k = 0; k < NumMods; ++ k)
				res &= hs[k] == that.hs[k];
			return res;
		}
		bool operator<(const Hash &that) const {
			for (int k = 0; k < NumMods; ++ k)
				if (hs[k] != that.hs[k])
					return hs[k] < that.hs[k];
			return false;
		}
		Hash &operator+=(const Hash &that) {
			for (int k = 0; k < NumMods; ++ k)
				if ((hs[k] += that.hs[k]) >= Mods[k])
					hs[k] -= Mods[k];
			return *this;
		}
		Hash operator+(const Hash &that) const { return Hash(*this) += that; }
		Hash &operator-=(const Hash &that) {
			for (int k = 0; k < NumMods; ++ k)
				if ((hs[k] += Mods[k] - that.hs[k]) >= Mods[k])
					hs[k] -= Mods[k];
			return *this;
		}
		Hash operator-(const Hash &that) const { return Hash(*this) -= that; }
		Hash operator*(const Hash &that) const {
			Hash res;
			for (int k = 0; k < NumMods; ++ k)
				res.hs[k] = (ull)hs[k] * that.hs[k] % Mods[k];
			return res;
		}
	};

	Hash seed;
	std::vector<Hash> powh;

	PolynomialHash() {
		random_device re;
		for (int k = 0; k < NumMods; ++ k) {
			unsigned x;
			do x = (unsigned)re(); while (x < 65536 || x >= Mods[k]);
			seed.hs[k] = x;
		}
	}

	void precomputePowerTable(int newSize) {
		int oldSize = (int)powh.size();
		if (oldSize >= newSize) return;
		powh.resize(newSize);
		if (oldSize == 0)
			powh[0] = Hash(1);
		for (int i = std::max(1, oldSize); i < newSize; i ++)
			powh[i] = powh[i - 1] * seed;
	}
};
const unsigned PolynomialHash::Mods[PolynomialHash::NumMods] = { 2147483647U, 2147483629U, 2147483587U, 2147483579U, 2147483563U };
namespace std {
	template<> struct hash<PolynomialHash::Hash> {
		size_t operator()(const PolynomialHash::Hash &h) const {
			return h.hs[0];
		}
	};
}

int main() {
	int N;
	while (~scanf("%d", &N)) {
		char alphas[101];
		scanf("%s", alphas);
		PolynomialHash ph;
		ph.precomputePowerTable(N + 1);
		using Hash = PolynomialHash::Hash;
		vector<Hash> chars(N * 2);
		for (int i = 0; i < N * 2; ++ i)
			chars[i] = Hash(alphas[i]);
		//rL || rR = rev(bR) || rev(bL)
		unordered_map<Hash, int> cntL;
		for (int S = 0; S < 1 << N; ++ S) {
			Hash r, b;
			int lenr = 0;
			for (int i = 0; i < N; ++ i) if (~S >> i & 1)
				r = r * ph.seed + chars[i], ++ lenr;
			for (int i = N - 1; i >= 0; -- i) if (S >> i & 1)
				b = b * ph.seed + chars[i];
			++ cntL[r * ph.powh[N - lenr] - b];
		}
		long long ans = 0;
		for (int S = 0; S < 1 << N; ++ S) {
			Hash r, b;
			int lenr = 0;
			for (int i = 0; i < N; ++ i) if (~S >> i & 1)
				r = r * ph.seed + chars[N + i], ++ lenr;
			for (int i = N - 1; i >= 0; -- i) if (S >> i & 1)
				b = b * ph.seed + chars[N + i];
			ans += cntL[b * ph.powh[lenr] - r];
		}
		printf("%lld\n", ans);
	}
}


Measured memory_bytes: 36980