def f():

    n,s=int(eval(input())),eval(input())

    a,b=s[n-1::-1],s[n:]

    from collections import defaultdict

    ad=defaultdict(int)

    bd=defaultdict(int)

    for i in range(2**n):

        sa,ta,sb,tb="","","",""

        for j in range(n):

            if i%2:

                sa+=a[j]

                sb+=b[j]

            else:

                ta+=a[j]

                tb+=b[j]

            i//=2

        ad[(sa,ta)]+=1

        bd[(sb,tb)]+=1

    ans=0

    for k in ad:

        ans+=bd[k]*ad[k]

    print(ans)

if __name__ == "__main__":

    f()

def f():

    n,s=int(eval(input())),eval(input())

    a,b=s[n-1::-1],s[n:]

    ad={}

    bd={}

    for i in range(2**n):

        sa,ta,sb,tb="","","",""

        for j in range(n):

            if i%2:

                sa+=a[j]

                sb+=b[j]

            else:

                ta+=a[j]

                tb+=b[j]

            i//=2

        ad[(sa,ta)]=(1 if (sa,ta)not in ad else ad[(sa,ta)]+1)

        bd[(sb,tb)]=(1 if (sb,tb)not in bd else bd[(sb,tb)]+1) 

    ans=0

    for k in ad:

        if k in bd:ans+=bd[k]*ad[k]

    print(ans)

if __name__ == "__main__":

    f()

def f():
    n, s = int(eval(input())), eval(input())
    a, b = s[n - 1 :: -1], s[n:]
    from collections import defaultdict

    ad = defaultdict(int)
    bd = defaultdict(int)
    for i in range(2**n):
        sa, ta, sb, tb = "", "", "", ""
        for j in range(n):
            if i % 2:
                sa += a[j]
                sb += b[j]
            else:
                ta += a[j]
                tb += b[j]
            i //= 2
        ad[(sa, ta)] += 1
        bd[(sb, tb)] += 1
    ans = 0
    for k in ad:
        ans += bd[k] * ad[k]
    print(ans)


if __name__ == "__main__":
    f()

def f():
    n, s = int(eval(input())), eval(input())
    a, b = s[n - 1 :: -1], s[n:]
    ad = {}
    bd = {}
    for i in range(2**n):
        sa, ta, sb, tb = "", "", "", ""
        for j in range(n):
            if i % 2:
                sa += a[j]
                sb += b[j]
            else:
                ta += a[j]
                tb += b[j]
            i //= 2
        ad[(sa, ta)] = 1 if (sa, ta) not in ad else ad[(sa, ta)] + 1
        bd[(sb, tb)] = 1 if (sb, tb) not in bd else bd[(sb, tb)] + 1
    ans = 0
    for k in ad:
        if k in bd:
            ans += bd[k] * ad[k]
    print(ans)


if __name__ == "__main__":
    f()

-    from collections import defaultdict - -    ad = defaultdict(int) -    bd = defaultdict(int) +    ad = {} +    bd = {} -        ad[(sa, ta)] += 1 -        bd[(sb, tb)] += 1 +        ad[(sa, ta)] = 1 if (sa, ta) not in ad else ad[(sa, ta)] + 1 +        bd[(sb, tb)] = 1 if (sb, tb) not in bd else bd[(sb, tb)] + 1 -        ans += bd[k] * ad[k] +        if k in bd: +            ans += bd[k] * ad[k]