#include <algorithm>
#include <array>
#include <cassert>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

/*std::int64_t count(int* first, int* last) {
    if (*first == *last) {
        
    }
}*/

std::int64_t count0(const std::string& str);
std::int64_t count1(const std::string& str, const std::string& str2);
std::int64_t count2(const std::string& str, const std::string& str2);

std::int64_t count0(const std::string& str)
{
    if (str.empty()) {
        return 1;
    }
    auto s = str;
    return count1(str.substr(1), str.substr(0, 1)) * 2;
}

std::int64_t count1(const std::string& str, const std::string& str2)
{
    if (str2.size() > str.size()) {
        return 0;
    }
    if (str2.empty()) {
        return count0(str);
    }
    if (str2.size() == str.size()) {
        auto s = str;
        std::reverse(s.begin(), s.end());
        if (str2 == s) {
            return 1;
        } else {
            return 0;
        }
    }
    static std::unordered_map<std::string, std::int64_t> datas;
    auto prev_data = datas.find(str + '/' + str2);
    if (prev_data != datas.end()) {
        return prev_data->second;
    }
    std::int64_t result = 0;
    {
        std::function<void(std::string, const std::string&, std::string)> hoge = [&](std::string s, const std::string& s2, std::string s3) {
            while (s.size() > s2.size()) {
                char c = s.back();
                s.pop_back();
                if (c == s2[0]) {
                    auto s22 = s2;
                    s22.erase(s22.begin());
                    if (s22.empty()) {
                        result += count2(s, s3);
                    } else {
                        hoge(s, s22, s3);
                    }
                }
                {
                    s3.push_back(c);
                }
            }
        };
        hoge(str, str2, "");
        datas.emplace(str + '/' + str2, result);
        return result;
    }
}

std::int64_t count2(const std::string& str, const std::string& str2)
{
    if (str2.size() > str.size()) {
        return 0;
    }
    if (str2.empty()) {
        return count0(str);
    }
    if (str2.size() == str.size()) {
        if (str2 == str) {
            return 1;
        } else {
            return 0;
        }
    }
    static std::unordered_map<std::string, std::int64_t> datas;
    auto prev_data = datas.find(str + '/' + str2);
    if (prev_data != datas.end()) {
        return prev_data->second;
    }
    std::int64_t result = 0;
    {
        std::function<void(std::string, const std::string&, std::string)> hoge = [&](std::string s, const std::string& s2, std::string s3) {
            while (s.size() > s2.size()) {
                char c = s.front();
                s.erase(s.begin());
                if (c == s2[0]) {
                    auto s22 = s2;
                    s22.erase(s22.begin());
                    if (s22.empty()) {
                        result += count1(s, s3);
                    } else {
                        hoge(s, s22, s3);
                    }
                }
                {
                    s3.push_back(c);
                }
            }
        };
        hoge(str, str2, "");
        datas.emplace(str + '/' + str2, result);
        return result;
    }
}

int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);

    std::size_t N;
    std::cin >> N;
    std::string str;
    std::cin >> str;
    if (str.size() != 2 * N) {
        std::cerr << "size mismatch" << std::endl;
        return 1;
    }
    std::cout << count0(str) << std::endl;
    return 0;
}


Measured memory_bytes: 256