import sys



def I(): return int(sys.stdin.readline().rstrip())

def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし



N = I()

S = LS2()



# 左N個のマスをどう塗るかで半分全列挙



ans = 0

left = []

right = []

for i in range(2**N):

    red = []

    blue = []

    for j in range(N):

        if (i >> j) & 1:

            red.append(S[j])

        else:

            blue.append(S[j])

    red = ''.join(red)

    blue = ''.join(blue)

    left.append((red,blue))

for i in range(2**N):

    red = []

    blue = []

    for j in range(N):

        if (i >> j) & 1:

            red.append(S[j+N])

        else:

            blue.append(S[j+N])

    red,blue = blue,red

    red.reverse()

    blue.reverse()

    red = ''.join(red)

    blue = ''.join(blue)

    right.append((red,blue))



from operator import itemgetter



right = sorted(right,key = itemgetter(0,1))



from bisect import bisect_left,bisect



ans = 0

for i in range(2**N):

    ans += bisect(right,left[i]) - bisect_left(right,left[i])



print(ans)
import sys



sys.setrecursionlimit(10**7)

def I(): return int(sys.stdin.readline().rstrip())

def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

def S(): return sys.stdin.readline().rstrip()

def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり

def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし





N = I()

S = LS2()



from collections import defaultdict



d_left = defaultdict(int)

d_right = defaultdict(int)



for i in range(2**N):

    left_red = ''

    left_blue = ''

    right_red = ''

    right_blue = ''

    for j in range(N):

        if (i >> j) & 1:

            left_red += S[j]

        else:

            left_blue += S[j]

    for j in range(2*N-1,N-1,-1):

        if (i >> (j-N)) & 1:

            right_red += S[j]

        else:

            right_blue += S[j]

    d_left[(left_red,left_blue)] += 1

    d_right[(right_red,right_blue)] += 1



ans = 0

for key in list(d_left.keys()):

    ans += d_left[key]*d_right[key]



print(ans)

import sys


def I():
    return int(sys.stdin.readline().rstrip())


def LS2():
    return list(sys.stdin.readline().rstrip())  # 空白なし


N = I()
S = LS2()
# 左N個のマスをどう塗るかで半分全列挙
ans = 0
left = []
right = []
for i in range(2**N):
    red = []
    blue = []
    for j in range(N):
        if (i >> j) & 1:
            red.append(S[j])
        else:
            blue.append(S[j])
    red = "".join(red)
    blue = "".join(blue)
    left.append((red, blue))
for i in range(2**N):
    red = []
    blue = []
    for j in range(N):
        if (i >> j) & 1:
            red.append(S[j + N])
        else:
            blue.append(S[j + N])
    red, blue = blue, red
    red.reverse()
    blue.reverse()
    red = "".join(red)
    blue = "".join(blue)
    right.append((red, blue))
from operator import itemgetter

right = sorted(right, key=itemgetter(0, 1))
from bisect import bisect_left, bisect

ans = 0
for i in range(2**N):
    ans += bisect(right, left[i]) - bisect_left(right, left[i])
print(ans)

import sys

sys.setrecursionlimit(10**7)


def I():
    return int(sys.stdin.readline().rstrip())


def MI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


def LI():
    return list(map(int, sys.stdin.readline().rstrip().split()))  # 空白あり


def LI2():
    return list(map(int, sys.stdin.readline().rstrip()))  # 空白なし


def S():
    return sys.stdin.readline().rstrip()


def LS():
    return list(sys.stdin.readline().rstrip().split())  # 空白あり


def LS2():
    return list(sys.stdin.readline().rstrip())  # 空白なし


N = I()
S = LS2()
from collections import defaultdict

d_left = defaultdict(int)
d_right = defaultdict(int)
for i in range(2**N):
    left_red = ""
    left_blue = ""
    right_red = ""
    right_blue = ""
    for j in range(N):
        if (i >> j) & 1:
            left_red += S[j]
        else:
            left_blue += S[j]
    for j in range(2 * N - 1, N - 1, -1):
        if (i >> (j - N)) & 1:
            right_red += S[j]
        else:
            right_blue += S[j]
    d_left[(left_red, left_blue)] += 1
    d_right[(right_red, right_blue)] += 1
ans = 0
for key in list(d_left.keys()):
    ans += d_left[key] * d_right[key]
print(ans)

+ +sys.setrecursionlimit(10**7) + + +def MI(): +    return list(map(int, sys.stdin.readline().rstrip().split())) + + +def LI(): +    return list(map(int, sys.stdin.readline().rstrip().split()))  # 空白あり + + +def LI2(): +    return list(map(int, sys.stdin.readline().rstrip()))  # 空白なし + + +def S(): +    return sys.stdin.readline().rstrip() + + +def LS(): +    return list(sys.stdin.readline().rstrip().split())  # 空白あり -# 左N個のマスをどう塗るかで半分全列挙 -ans = 0 -left = [] -right = [] +from collections import defaultdict + +d_left = defaultdict(int) +d_right = defaultdict(int) -    red = [] -    blue = [] +    left_red = "" +    left_blue = "" +    right_red = "" +    right_blue = "" -            red.append(S[j]) +            left_red += S[j] -            blue.append(S[j]) -    red = "".join(red) -    blue = "".join(blue) -    left.append((red, blue)) -for i in range(2**N): -    red = [] -    blue = [] -    for j in range(N): -        if (i >> j) & 1: -            red.append(S[j + N]) +            left_blue += S[j] +    for j in range(2 * N - 1, N - 1, -1): +        if (i >> (j - N)) & 1: +            right_red += S[j] -            blue.append(S[j + N]) -    red, blue = blue, red -    red.reverse() -    blue.reverse() -    red = "".join(red) -    blue = "".join(blue) -    right.append((red, blue)) -from operator import itemgetter - -right = sorted(right, key=itemgetter(0, 1)) -from bisect import bisect_left, bisect - +            right_blue += S[j] +    d_left[(left_red, left_blue)] += 1 +    d_right[(right_red, right_blue)] += 1 -for i in range(2**N): -    ans += bisect(right, left[i]) - bisect_left(right, left[i]) +for key in list(d_left.keys()): +    ans += d_left[key] * d_right[key]