import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

alias Pair = Tuple!(string, "red", string, "blue");

void main() {
    int n;
    scan(n);
    auto s = readln.chomp;
    auto mae = s[0 .. n];
    auto ato = s[n .. $].retro.to!string;
    debug {
        writeln(mae);
        writeln(ato);
    }
    long[Pair] asc;

    foreach (i ; 0 .. (1<<n)) {
        string r, b;
        foreach (j ; 0 .. n) {
            if (i & (1 << j)) {
                r ~= mae[j];
            }
            else {
                b ~= mae[j];
            }
        }
        auto pr = Pair(r, b);
        if (pr in asc) {
            asc[pr]++;
        }
        else {
            asc[pr] = 1;
        }
    }

    long ans;

    foreach (i ; 0 .. (1<<n)) {
        string r, b;

        foreach (j ; 0 .. n) {
            if (i & (1 << j)) {
                r ~= ato[j];
            }
            else {
                b ~= ato[j];
            }
        }

        auto pr = Pair(r, b);

        if (pr in asc) {
            ans += asc[pr];
        }
    }

    writeln(ans);
}










































void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}
