#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define iter(v, i) for (__typeof__((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define fast_io_without_cstdio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define all(v) (v).begin(), (v).end()
#define rep(i, s, e) for (int i = s; i < e; i++)

// START for segment tree
#define params int p, int L, int R
#define housekeep int mid = (L + R) >> 1, left = p << 1, right = left | 1
// END

#ifdef __linux__
#define gc getchar_unlocked
#define pc putchar_unlocked
#else
#define gc getchar
#define pc putchar
#endif

#if __cplusplus <= 199711L
template<class BidirIt>
BidirIt prev(BidirIt it, typename iterator_traits<BidirIt>::difference_type n = 1) {
    advance(it, -n);
    return it;
}

template<class ForwardIt>
ForwardIt next(ForwardIt it, typename iterator_traits<ForwardIt>::difference_type n = 1) {
    advance(it, n);
    return it;
}
#endif

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ldouble;

const double EPS = 1e-9;
const double PI = 3.141592653589793238462;

template<typename T>
inline T sq(T a) { return a * a; }

//#ifdef LOCAL_MACHINE
//#endif

#define SIZE 4

const int MOD[SIZE] = {(int)1e9 + 7, (int)1e9 + 9, 1000000223, 1000000579};
const int BASE[SIZE] = {31, 29, 107, 151};

struct myhash {
    vi val;

    myhash() { val.assign(SIZE, 0); }

    inline bool operator <(const myhash &rhs) const {
        return val < rhs.val;
    }

    inline myhash operator -(const myhash &rhs) const {
        myhash res;
        for (int i = 0; i < SIZE; i++)
            res.val[i] = (val[i] - rhs.val[i] + MOD[i]) % MOD[i];
        return res;
    }
};

void add_mod(myhash &a, int b) {
    for (int i = 0; i < SIZE; i++) {
        a.val[i] += b;
        if (a.val[i] >= MOD[i]) a.val[i] -= MOD[i];
    }
}

myhash mul_mod(myhash a, ...) {
    myhash res;
    for (int i = 0; i < SIZE; i++) {
        res.val[i] = (a.val[i] * 1LL * BASE[i]) % MOD[i];
    }
    return res;
}

char str[18 * 2 + 5];
map<myhash, int> cnt[20];

int main() {
    //srand(time(NULL));
    //const int which = rand() % 4;
    const int which = 3;
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    int n;
    scanf("%d", &n);
    scanf(" %s", str);
    for (int mask = 0; mask < (1 << n); mask++) {
        int cnt_r = __builtin_popcount(mask);
        myhash red, blue;
        for (int i = 0; i < n; i++) {
            if (mask & (1 << i)) {
                red = mul_mod(red, BASE);
                add_mod(red, str[n + i] - 'a' + 1);
            }
        }
        for (int i = n - 1; i >= 0; i--) {
            if ((mask & (1 << i)) == 0) {
                blue = mul_mod(blue, BASE);
                add_mod(blue, str[n + i] - 'a' + 1);
            }
        }
        for (int i = 0; i < cnt_r; i++)
            blue = mul_mod(blue, BASE);
        cnt[cnt_r][blue - red]++;
    }
    ll ans = 0;
    for (int mask = 0; mask < (1 << n); mask++) {
        int cnt_r = __builtin_popcount(mask);
        myhash red, blue;
        for (int i = 0; i < n; i++) {
            if (mask & (1 << i)) {
                red = mul_mod(red, BASE);
                add_mod(red, str[i] - 'a' + 1);
            }
        }
        for (int i = n - 1; i >= 0; i--) {
            if ((mask & (1 << i)) == 0) {
                blue = mul_mod(blue, BASE[which]);
                add_mod(blue, str[i] - 'a' + 1);
            }
        }
        for (int i = 0; i < (n - cnt_r); i++)
            red = mul_mod(red, BASE);
        ans += cnt[n - cnt_r][red - blue];
    }
    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 57600