#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define cshow(x) cerr<<#x<<" = "<<(x)<<endl
#define sar(a,n) {cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl;}

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>&m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
template<typename S,typename T,typename U>
struct TRI{S fi;T se;U th;TRI(){}TRI(S f,T s,U t):fi(f),se(s),th(t){}
bool operator<(const TRI&_)const{return(fi==_.fi)?((se==_.se)?(th<_.th):(se<_.se)):(fi<_.fi);}};
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,TRI<S,T,U>&t){return o<<"{"<<t.fi<<","<<t.se<<","<<t.th<<"}";}

typedef pair<int, int> P;
typedef pair<ll, ll> pll;
typedef TRI<int, int, int> tri;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

template<class _Key, class _Tp, class _Hash, bool DOWNSIZE> class UnorderedMapIterator;

template<class _Key, class _Tp, class _Hash = hash<_Key>, bool DOWNSIZE = false>
class UnorderedMap
{
private:
    using iterator = UnorderedMapIterator<_Key, _Tp, _Hash, DOWNSIZE>;
    using data_type = pair<_Key, _Tp>;
    using aligned_pointer = typename aligned_storage<sizeof(data_type), alignof(data_type)>::type;
    friend UnorderedMapIterator<_Key, _Tp, _Hash, DOWNSIZE>;
    struct bucket {
        unsigned int _hash;
        short int _dist;
        bool _last, _end;
        aligned_pointer _data_ptr;
        // data_type* _data_ptr;
        bucket() noexcept : _dist(-1), _last(false), _end(false){}
        bucket(const bucket& another) noexcept
            : _hash(another._hash), _dist(another._dist), _last(another._last), _end(another._end){
            if(!another.empty()) new(&_data_ptr) data_type(another.data());
        }
        ~bucket(){ if(!empty()) _delete(); }
        inline void clear() noexcept { _dist = -1; }
        inline void _delete(){ _dist = -1, data_ptr()->~data_type(); }
        inline bool empty() const noexcept { return (_dist == -1); }
        inline data_type& data() noexcept {
            return *reinterpret_cast<data_type*>(addressof(_data_ptr));
        }
        inline const data_type& data() const noexcept {
            return *reinterpret_cast<const data_type*>(addressof(_data_ptr));
        }
        inline data_type* data_ptr() noexcept {
            return reinterpret_cast<data_type*>(addressof(_data_ptr));
        }
        inline const _Key& get_key() noexcept { return data_ptr()->first; }
        template<typename... Args>
        inline void new_data(Args&&... data){
            new(&_data_ptr) data_type(forward<Args>(data)...);
        }
    };
    inline static unsigned int ceilpow2(unsigned int u) noexcept {
        --u, u |= u >> 1, u |= u >> 2, u |= u >> 4, u |= u >> 8;
        return (u | (u >> 16)) + 1;
    }
    inline static bucket *increment(bucket *cur) noexcept {
        for(++cur; !cur->_end; ++cur){
            if(!cur->empty()) break;
        }
        return cur;
    }
    inline void next_bucket(unsigned int& index) const noexcept {
        if(index == _bucket_count - 1) index = 0;
        else ++index;
    }
    inline unsigned int make_hash(const _Key& key) const noexcept {
        return _Hash()(key);
    }
    inline float load_factor() const noexcept {
        return (float)_data_count / _bucket_count;
    }
    void insert_impl(unsigned int index, unsigned int hash, short int dist, data_type& data){
        while(true){
            if(dist > B[index]._dist){
                if(B[index].empty()){
                    B[index]._hash = hash, B[index]._dist = dist, B[index].new_data(move(data));
                    break;
                }else{
                    swap(hash, B[index]._hash), swap(dist, B[index]._dist), swap(data, B[index].data());
                }
            }
            ++dist;
            next_bucket(index);
        }
    }
    bucket *_find(const _Key& key, bool push=false){
        unsigned int hash = make_hash(key);
        unsigned int index = (hash & _mask);
        short int dist = 0;
        while(dist <= B[index]._dist){
            if(hash == B[index]._hash && key == B[index].get_key()){
                return &B[index];
            }
            ++dist;
            next_bucket(index);
        }
        if(!push) return &B[_bucket_count];
        ++_data_count;
        if(rehash_check()){
            hash = make_hash(key), index = (hash & _mask), dist = 0;
            while(dist <= B[index]._dist){
                next_bucket(index);
                ++dist;
            }
        }
        if(B[index].empty()){
            B[index]._hash = hash, B[index]._dist = dist, B[index].new_data();
        }else{
            data_type _data = data_type();
            insert_impl(index, hash, dist, _data);
        }
        B[index].data_ptr()->first = key;
        return &B[index];
    }
    // bucket *backward_shift(bucket *cur, bool next_ret){
    //     bucket *next = next_bucket(cur), *ret = cur;
    //     if(next->_dist < 1) return next_ret ? increment(cur) : cur;
    //     do {
    //         cur->_hash = next->_hash;
    //         cur->_dist = next->_dist - 1;
    //         cur->_data_ptr = next->_data_ptr;
    //         cur = next, next = next_bucket(cur);
    //     }while(next->_dist >= 1);
    //     cur->clear();
    //     return ret;
    // }
    // bucket *erase_impl(bucket *cur, bool next_ret){
    //     assert(cur != _buckets + _bucket_count);
    //     cur->_delete();
    //     return backward_shift(cur, next_ret);
    // }
    // bucket *erase_itr(bucket *cur, bool next_ret = true){
    //     --_data_count;
    //     const _Key& key = cur->get_key();
    //     return erase_impl(rehash_check() ? _find(key) : cur, next_ret);
    // }
    // bucket *erase_key(const _Key& key, bool next_ret = true){
    //     --_data_count;
    //     rehash_check();
    //     return erase_impl(_find(key), next_ret);
    // }
    bool rehash_check(){
        if(load_factor() >= MAX_LOAD_FACTOR){
            rehash(_bucket_count * 2);
            return true;
        }else if(DOWNSIZE){
            if(load_factor() <= MIN_LOAD_FACTOR && _bucket_count >= DOWNSIZE_THRESHOLD){
                rehash(_bucket_count / 2);
                return true;
            }else{
                return false;
            }
        }else{
            return false;
        }
    }
    void move_data(data_type&& data){
        unsigned int hash = make_hash(data.first);
        unsigned int index = (hash & _mask);
        short int dist = 0;
        while(true){
            if(dist > B[index]._dist){
                if(B[index].empty()){
                    B[index]._hash = hash, B[index]._dist = dist, B[index].new_data(move(data));
                    return;
                }else{
                    swap(hash, B[index]._hash), swap(dist, B[index]._dist), swap(data, B[index].data());
                }
            }
            ++dist;
            next_bucket(index);
        }
    }
    void rehash(unsigned int new_bucket_count){
        UnorderedMap new_unordered_map(new_bucket_count);
        for(auto& bucket : _buckets){
            if(!bucket.empty()){
                new_unordered_map.move_data(move(bucket.data()));
            }
        }
        new_unordered_map._data_count = _data_count;
        swap(*this, new_unordered_map);
    }
    friend void swap(UnorderedMap& ump1, UnorderedMap& ump2){
        swap(ump1._bucket_count, ump2._bucket_count);
        swap(ump1._mask, ump2._mask);
        swap(ump1._data_count, ump2._data_count);
        swap(ump1._buckets, ump2._buckets);
        swap(ump1.B, ump2.B);
    }

private:
public:
    unsigned int _bucket_count, _mask, _data_count;
    vector<bucket> _buckets;
    bucket *B;
    const float MAX_LOAD_FACTOR = 0.5f;
    const float MIN_LOAD_FACTOR = 0.1f;
    const unsigned int DOWNSIZE_THRESHOLD = 16u;
    UnorderedMap(unsigned int bucket_size = 1u)
     : _bucket_count(ceilpow2(max(bucket_size, 1u))), _mask(_bucket_count - 1),
        _data_count(0u), _buckets(_bucket_count + 1), B(_buckets.data()){
        _buckets[_bucket_count - 1]._last = true, _buckets[_bucket_count]._end = true;
    }
    UnorderedMap(const UnorderedMap& other)
        : _bucket_count(other._bucket_count), _mask(other._mask), _data_count(other._data_count),
            _buckets(other._buckets), B(_buckets.data()){}
    ~UnorderedMap(){}
    friend ostream& operator<< (ostream& os, UnorderedMap& ump) noexcept {
        // for(auto it = ump.B; !it->_end; ++it){
            // if(!it->empty()) cout << it->_dist << " " << it->data() << endl;
        // }
        // for(auto& it : ump._buckets) if(!it.empty()) os << it._dist << " " << it.data() << endl;
        // assert(ump.B == ump._buckets.data());
        // os << "1" << endl;
        // for(unsigned int i = 0; i < ump._bucket_count; ++i){
        //     os << &ump._buckets[i] << endl;
        //     if(!ump._buckets[i].empty()){
        //         os << ump._buckets[i].data() << endl;
        //     }
        // }
        // os << "2" << endl;
        // for(auto it = ump.B; !it->_end; ++it){
        //     os << it << endl;
        //     if(!it->empty()){
        //         os << it->data() << endl;
        //     }
        // }
        // for(auto it = ump.begin(); it != ump.end(); ++it){
            // os << (it.bucket_ptr->_dist) << " " << it.bucket_ptr->data() << endl;
        // }
        for(data_type& val : ump) os << '{' << val.first << ',' << val.second << "} ";
        // for(data_type& val : ump) os << '{' << val.first << ',' << val.second << "} ";
        return os;
    }
    _Tp& operator[](const _Key& key){
        return _find(key, true)->data_ptr()->second;
    }
    const _Tp& at(const _Key& key){
        bucket *res = _find(key);
        if(static_cast<size_t>(res - B) == _bucket_count){
            __throw_out_of_range(__N("Unordered_Map::at"));
        }
        return res->data_ptr()->second;
    }
    void clear(){
        UnorderedMap new_unordered_set(1u);
        swap(*this, new_unordered_set);
    }
    size_t size() const noexcept { return _data_count; }
    size_t bucket_count() const noexcept { return _bucket_count; }
    bool empty() const noexcept { return (_data_count == 0); }
    iterator begin() const noexcept {
        return B->empty() ?
            iterator(increment(B)) : iterator(B);
    }
    iterator end() const noexcept { return iterator(B + _bucket_count); }
    iterator find(const _Key& key){ return iterator(_find(key)); }
    iterator insert(const data_type& data){ return iterator(_insert(data)); }
    iterator erase(const _Key& key){ return iterator(erase_key(key)); }
    iterator erase(const iterator& itr){ return iterator(erase_itr(itr.bucket_ptr)); }
    void simple_erase(const _Key& key){ erase_key(key, false); }
    void simple_erase(const iterator& itr){ erase_itr(itr.bucket_ptr, false); }

    // DEBUG 用
    short int maximum_distance() const noexcept {
        short int ret = -1;
        for(bucket *cur = _buckets; !cur->_end; ++cur){
            ret = max(ret, cur->_dist);
        }
        return ret;
    }
};

template<class _Key, class _Tp, class _Hash, bool DOWNSIZE>
class UnorderedMapIterator {
public:
    friend UnorderedMap<_Key, _Tp, _Hash, DOWNSIZE>;
    typename UnorderedMap<_Key, _Tp, _Hash, DOWNSIZE>::bucket *bucket_ptr;
    using iterator_category = forward_iterator_tag;
    using value_type = pair<_Key, _Tp>;
    using difference_type = ptrdiff_t;
    using pointer = pair<_Key, _Tp>*;
    using reference = pair<_Key, _Tp>&;

private:
    UnorderedMapIterator(typename UnorderedMap<_Key, _Tp, _Hash, DOWNSIZE>::bucket *_bucket_ptr)
        noexcept : bucket_ptr(_bucket_ptr){}
public:
    UnorderedMapIterator() noexcept : bucket_ptr(){}
    UnorderedMapIterator(const UnorderedMapIterator& itr) noexcept : bucket_ptr(itr.bucket_ptr){}
    UnorderedMapIterator& operator=(const UnorderedMapIterator& itr)
        & noexcept { return bucket_ptr = itr.bucket_ptr, *this; }
    UnorderedMapIterator& operator=(const UnorderedMapIterator&& itr)
        & noexcept { return bucket_ptr = itr.bucket_ptr, *this; }
    reference operator*() const noexcept { return bucket_ptr->data(); }
    pointer operator->() const noexcept { return bucket_ptr->data_ptr(); }
    UnorderedMapIterator& operator++() noexcept {
        // show("OK");
        return bucket_ptr = UnorderedMap<_Key, _Tp, _Hash, DOWNSIZE>::increment(bucket_ptr), *this;
    }
    UnorderedMapIterator operator++(int) const noexcept {
        return UnorderedMapIterator(UnorderedMap<_Key, _Tp, _Hash, DOWNSIZE>::increment(this->bucket_ptr));
    }
    bool operator==(const UnorderedMapIterator& itr) const noexcept { return !(*this != itr); };
    bool operator!=(const UnorderedMapIterator& itr) const noexcept { return bucket_ptr != itr.bucket_ptr; }
};

//0:red,1:blue
UnorderedMap<string,UnorderedMap<string,int> > mp[2];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    n *= 2;
    string s;
    cin >> s;
    rep(i,(1 << (n-n/2))){
        string red,blue;
        rep(j,n-n/2){
            if((i >> j) & 1){
                red.pb(s[j+n/2]);
            }else{
                blue.pb(s[j+n/2]);
            }
        }
        reverse(all(blue));
        if(len(red) <= len(blue)){
            mp[0][blue][red]++;
        }else{
            mp[1][red][blue]++;
        }
    }
    ll ans = 0;
    rep(i,(1 << n/2)){
        string red, blue;
        rep(j,n/2){
            if((i >> j) & 1){
                red.pb(s[j]);
            }else{
                blue.pb(s[j]);
            }
        }
        reverse(all(blue));
        if(len(red) >= len(blue)){
            ans += mp[0][red][blue];
        }else{
            ans += mp[1][blue][red];
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 278780