from collections import defaultdict



N = int(eval(input()))

S = eval(input())



S1 = S[:N]

S2 = S[N:][::-1]



ans = 0

D = defaultdict(int)



for i in range(2**N):

    bit = bin(2**N+i)[3:]



    red1 = "".join([d for d, s in zip(S1, bit) if s == "1"])

    blue1 = "".join([d for d, s in zip(S1, bit) if s == "0"])

    D[(red1, blue1)] += 1



for i in range(2**N):

    bit = bin(2 ** N + i)[3:]



    red2 = "".join([d for d, s in zip(S2, bit) if s == "1"])

    blue2 = "".join([d for d, s in zip(S2, bit) if s == "0"])

    ans += D[(blue2, red2)]



print(ans)

from itertools import product

from collections import defaultdict

N = int(eval(input()))

S = eval(input())



ans = 0

D = defaultdict(int)

for pattern in product([0, 1], repeat=N):

    red = ''.join([s for s, p in zip(S[:N], pattern) if p == 0])

    blue = ''.join([s for s, p in zip(S[:N], pattern) if p == 1])

    D[(red, blue)] += 1



for pattern in product([0, 1], repeat=N):

    red = ''.join([s for s, p in zip(S[N:], pattern) if p == 0])

    blue = ''.join([s for s, p in zip(S[N:], pattern) if p == 1])

    ans += D[(blue[::-1], red[::-1])]

print(ans)

from collections import defaultdict

N = int(eval(input()))
S = eval(input())
S1 = S[:N]
S2 = S[N:][::-1]
ans = 0
D = defaultdict(int)
for i in range(2**N):
    bit = bin(2**N + i)[3:]
    red1 = "".join([d for d, s in zip(S1, bit) if s == "1"])
    blue1 = "".join([d for d, s in zip(S1, bit) if s == "0"])
    D[(red1, blue1)] += 1
for i in range(2**N):
    bit = bin(2**N + i)[3:]
    red2 = "".join([d for d, s in zip(S2, bit) if s == "1"])
    blue2 = "".join([d for d, s in zip(S2, bit) if s == "0"])
    ans += D[(blue2, red2)]
print(ans)

from itertools import product
from collections import defaultdict

N = int(eval(input()))
S = eval(input())
ans = 0
D = defaultdict(int)
for pattern in product([0, 1], repeat=N):
    red = "".join([s for s, p in zip(S[:N], pattern) if p == 0])
    blue = "".join([s for s, p in zip(S[:N], pattern) if p == 1])
    D[(red, blue)] += 1
for pattern in product([0, 1], repeat=N):
    red = "".join([s for s, p in zip(S[N:], pattern) if p == 0])
    blue = "".join([s for s, p in zip(S[N:], pattern) if p == 1])
    ans += D[(blue[::-1], red[::-1])]
print(ans)

+from itertools import product -S1 = S[:N] -S2 = S[N:][::-1] -for i in range(2**N): -    bit = bin(2**N + i)[3:] -    red1 = "".join([d for d, s in zip(S1, bit) if s == "1"]) -    blue1 = "".join([d for d, s in zip(S1, bit) if s == "0"]) -    D[(red1, blue1)] += 1 -for i in range(2**N): -    bit = bin(2**N + i)[3:] -    red2 = "".join([d for d, s in zip(S2, bit) if s == "1"]) -    blue2 = "".join([d for d, s in zip(S2, bit) if s == "0"]) -    ans += D[(blue2, red2)] +for pattern in product([0, 1], repeat=N): +    red = "".join([s for s, p in zip(S[:N], pattern) if p == 0]) +    blue = "".join([s for s, p in zip(S[:N], pattern) if p == 1]) +    D[(red, blue)] += 1 +for pattern in product([0, 1], repeat=N): +    red = "".join([s for s, p in zip(S[N:], pattern) if p == 0]) +    blue = "".join([s for s, p in zip(S[N:], pattern) if p == 1]) +    ans += D[(blue[::-1], red[::-1])]