from collections import defaultdict

N=int(eval(input()))

S=eval(input())

A=S[:N]

B=S[N:]

B=B[::-1]

def f(A):

    dd=defaultdict(int)

    for i in range(1<<N):

        a=''

        b=''

        for j in range(N):

            if i&(1<<j):

                a+=A[j]

            else:

                b+=A[j]

        dd[(a,b)]+=1

    return dd

dd1=f(A)

dd2=f(B)

ans=0

for t,c in list(dd1.items()):

    ans+=dd2[t]*c

print(ans)
from collections import defaultdict

N=int(eval(input()))

S=eval(input())

A=S[:N]

B=S[N:]

B=B[::-1]

def f(A):

    dd=defaultdict(int)

    for i in range(1<<N):

        a=[]

        b=[]

        for j in range(N):

            if i&(1<<j):

                a.append(A[j])

            else:

                b.append(A[j])

        s=''.join(a)

        t=''.join(b)

        dd[(s,t)]+=1

    return dd

dd1=f(A)

dd2=f(B)

ans=0

for t,c in list(dd1.items()):

    ans+=dd2[t]*c

print(ans)



from collections import defaultdict

N = int(eval(input()))
S = eval(input())
A = S[:N]
B = S[N:]
B = B[::-1]


def f(A):
    dd = defaultdict(int)
    for i in range(1 << N):
        a = ""
        b = ""
        for j in range(N):
            if i & (1 << j):
                a += A[j]
            else:
                b += A[j]
        dd[(a, b)] += 1
    return dd


dd1 = f(A)
dd2 = f(B)
ans = 0
for t, c in list(dd1.items()):
    ans += dd2[t] * c
print(ans)

from collections import defaultdict

N = int(eval(input()))
S = eval(input())
A = S[:N]
B = S[N:]
B = B[::-1]


def f(A):
    dd = defaultdict(int)
    for i in range(1 << N):
        a = []
        b = []
        for j in range(N):
            if i & (1 << j):
                a.append(A[j])
            else:
                b.append(A[j])
        s = "".join(a)
        t = "".join(b)
        dd[(s, t)] += 1
    return dd


dd1 = f(A)
dd2 = f(B)
ans = 0
for t, c in list(dd1.items()):
    ans += dd2[t] * c
print(ans)

-        a = "" -        b = "" +        a = [] +        b = [] -                a += A[j] +                a.append(A[j]) -                b += A[j] -        dd[(a, b)] += 1 +                b.append(A[j]) +        s = "".join(a) +        t = "".join(b) +        dd[(s, t)] += 1