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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(auto i##0_to = (t), i = decltype(t)(f); i <= i##0_to; i++)
#define uptil(f, t, i)   for(auto i##0_to = (t), i = decltype(t)(f); i <  i##0_to; i++)
#define downto(f, t, i)  for(auto i##0_to = decltype(f)(t), i = (f); i >= i##0_to; i--)
#define downtil(f, t, i) for(auto i##0_to = decltype(f)(t), i = (f); i >  i##0_to; i--)
using LD = long double;
#define double LD
#define long long long
#define LL long
#define int long
template<class T> using vec = vector<T>;
using VB = vec<bool>;   using WB = vec<VB>;
using VC = vec<char>;   using WC = vec<VC>;
using VI = vec<int>;    using WI = vec<VI>;
using VD = vec<double>; using WD = vec<VD>;
using VS = vec<string>; using WS = vec<VS>;
using PI = pair<int, int>;  using VPI = vec<PI>; using WPI = vec<VPI>;
using MI = map<int, int>;   using VMI = vec<MI>;

#if defined(EBUG) && !defined(ONLINE_JUDGE)
    #define debug true
    #define _GLIBCXX_DEBUG
    #define _LIBCPP_DEBUG 2
    #define _LIBCPP_DEBUG2 2
    #define ln << endl
    #define dd(x) cerr << #x << " = " << (x) << ", "
    #define ddd(x) cerr << #x << " = " << (x) ln
#else
    #define debug false
    #define ln << '\n'
    #define dd(x) cerr
    #define ddd(x) cerr
#endif
#define tb << '\t'
#define sp << ' '
#define db dd
#define dbg ddd

template<class T>          inline istream& operator>>(istream& s, vec<T>& v) { for(auto&& p : v) s >> p; return s; }
template<class T, class S> inline ostream& operator<<(ostream&, const pair<T, S>&);
template<class T>          inline ostream& operator<<(ostream&, const vec<T>&);
template<class T, class S> inline ostream& operator<<(ostream&, const map<T, S>&);
#define DEFINE_ITER_OUTPUT(s, x, sep) { int i = 0; for(const auto& x##0_elem : x) { if(i++) s << sep; s << x##0_elem; } return s; }
template<class T, class S> inline ostream& operator<<(ostream& s, const pair<T, S>& p) { return s << "(" << p.first << "," << p.second << ")"; }
template<class T>          inline ostream& operator<<(ostream& s, const vec<T>& v) DEFINE_ITER_OUTPUT(s, v, ' ')
template<class T, class S> inline ostream& operator<<(ostream& s, const map<T, S>& m) DEFINE_ITER_OUTPUT(s, m, ' ')
template<class T>          inline ostream& operator<<(ostream& s, const vec<vec<T>>& w) DEFINE_ITER_OUTPUT(s, w, '\n')
template<class T, class S> inline ostream& operator<<(ostream& s, const vec<map<T, S>>& vm) DEFINE_ITER_OUTPUT(s, vm, '\n')


void solve();

signed main() {
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(20);

    solve();

    return 0;
}

void solve() {
// N "S"
/* <foxy.memo-area> */
int N;string tmp;cin>>N;cin>>tmp;
/* </foxy.memo-area> */

    int S[36];
    times(2*N, i) S[i] = tmp[i] - 'a';

    VI cnt(26);
    times(N, i) {
        ++cnt[S[i]];
    }
    uptil(N, N*2, i) {
        --cnt[S[i]];
    }
    times(26, c) {
        if(cnt[c] != 0) {
            if(debug) {
                cerr << cnt ln;
            }
            cout << 0 ln;
            return;
        }
    }

    int ans = 0;
    VI ca, cb;
    times((1<<N), b) {
        ca.clear();
        cb.clear();
        downto(N*2-1, N, i) {
            if(b & (1 << (i-N))) {
                ca.push_back(S[i]);
            } else {
                cb.push_back(S[i]);
            }
        }
        if(debug) {
            cerr << b << ":" tb << ca ln tb << cb ln;
        }
        int na = ca.size(), nb = cb.size();
        WI pyon(na+1, VI(nb+1));
        pyon[0][0] = 1;
        times(N, i) {
            upto(0, min(na, i), ja) {
                int jb = i - ja;
                if(jb < 0 or nb < jb) continue;
                // if(debug) cerr << "; " << ja sp << jb;
                if(pyon[ja][jb]) {
                    if(ja != na && S[i] == ca[ja]) pyon[ja+1][jb] += pyon[ja][jb];
                    if(jb != nb && S[i] == cb[jb]) pyon[ja][jb+1] += pyon[ja][jb];
                }
            }
            if(debug) {
                // cerr ln << S[i] << "." ln << pyon ln << "----------" ln;
            }
        }
        ans += pyon[na][nb];
    }
    cout << ans ln;
}


Measured memory_bytes: 384