def f(i, k):

    if i == n and k == 0:

        global d

        hr1, hb1 = 0, 0

        hr2, hb2 = 0, 0

        cntr, cntb = 0, 0

        for j in range(n):

            if c[j]:

                hr1 += x[j] * pow(b1, cntr, mod)

                hr2 += x[j] * pow(b2, cntr, mod)

                hr1 %= mod

                hr2 %= mod

                cntr += 1

            else:

                hb1 += x[j] * pow(b1, cntb, mod)

                hb2 += x[j] * pow(b2, cntb, mod)

                hb1 %= mod

                hb2 %= mod

                cntb += 1

        if min(cntr, cntb) == 0:

            return

        if (hr1, hr2, hb1, hb2) in d:

            d[(hr1, hr2, hb1, hb2)] += 1

        else:

            d[(hr1, hr2, hb1, hb2)] = 1

        return

    elif i == n and k == 1:

        hr1, hb1 = 0, 0

        hr2, hb2 = 0, 0

        cntr, cntb = 0, 0

        for j in range(n):

            if c[j]:

                hr1 += y[j] * powb1[cntr]

                hr2 += y[j] * powb2[cntr]

                hr1 %= mod

                hr2 %= mod

                cntr += 1

            else:

                hb1 += y[j] * powb1[cntb]

                hb2 += y[j] * powb2[cntb]

                hb1 %= mod

                hb2 %= mod

                cntb += 1

        if min(cntr, cntb) == 0:

            return

        if (hr1, hr2, hb1, hb2) in d:

            global ans

            ans += d[(hr1, hr2, hb1, hb2)]

        return

    c[i] = 1

    f(i + 1, k)

    c[i] = 0

    f(i + 1, k)





n = int(eval(input()))

s = list(eval(input()))

mod = pow(2, 31) - 1

b1, b2 = 27, 31

powb1 = [pow(27, i, mod) for i in range(n)]

powb2 = [pow(31, i, mod) for i in range(n)]

d = {}

x, y = [], []

for i in range(n):

    x.append(ord(s[i]) - 96)

    y.append(ord(s[-(i + 1)]) - 96)

ans = 0 if not x == y else 2

c = [0] * n

f(0, 0)

c = [0] * n

f(0, 1)

print(ans)
def f(i, k):

    if i == n and k == 0:

        global d

        hr1, hb1 = 0, 0

        hr2, hb2 = 0, 0

        cntr, cntb = 0, 0

        for j in range(n):

            if c[j]:

                hr1 += x[j] * powb1[cntr]

                hr2 += x[j] * powb2[cntr]

                hr1 %= mod

                hr2 %= mod

                cntr += 1

            else:

                hb1 += x[j] * powb1[cntb]

                hb2 += x[j] * powb2[cntb]

                hb1 %= mod

                hb2 %= mod

                cntb += 1

        if min(cntr, cntb) == 0:

            return

        if (hr1, hr2, hb1, hb2) in d:

            d[(hr1, hr2, hb1, hb2)] += 1

        else:

            d[(hr1, hr2, hb1, hb2)] = 1

        return

    elif i == n and k == 1:

        hr1, hb1 = 0, 0

        hr2, hb2 = 0, 0

        cntr, cntb = 0, 0

        for j in range(n):

            if c[j]:

                hr1 += y[j] * powb1[cntr]

                hr2 += y[j] * powb2[cntr]

                hr1 %= mod

                hr2 %= mod

                cntr += 1

            else:

                hb1 += y[j] * powb1[cntb]

                hb2 += y[j] * powb2[cntb]

                hb1 %= mod

                hb2 %= mod

                cntb += 1

        if min(cntr, cntb) == 0:

            return

        if (hr1, hr2, hb1, hb2) in d:

            global ans

            ans += d[(hr1, hr2, hb1, hb2)]

        return

    c[i] = 1

    f(i + 1, k)

    c[i] = 0

    f(i + 1, k)





n = int(eval(input()))

s = list(eval(input()))

mod = pow(2, 31) - 1

b1, b2 = 27, 31

powb1 = [pow(27, i, mod) for i in range(n)]

powb2 = [pow(31, i, mod) for i in range(n)]

d = {}

x, y = [], []

for i in range(n):

    x.append(ord(s[i]) - 96)

    y.append(ord(s[-(i + 1)]) - 96)

ans = 0 if not x == y else 2

c = [0] * n

f(0, 0)

c = [0] * n

f(0, 1)

print(ans)
def f(i, k):
    if i == n and k == 0:
        global d
        hr1, hb1 = 0, 0
        hr2, hb2 = 0, 0
        cntr, cntb = 0, 0
        for j in range(n):
            if c[j]:
                hr1 += x[j] * pow(b1, cntr, mod)
                hr2 += x[j] * pow(b2, cntr, mod)
                hr1 %= mod
                hr2 %= mod
                cntr += 1
            else:
                hb1 += x[j] * pow(b1, cntb, mod)
                hb2 += x[j] * pow(b2, cntb, mod)
                hb1 %= mod
                hb2 %= mod
                cntb += 1
        if min(cntr, cntb) == 0:
            return
        if (hr1, hr2, hb1, hb2) in d:
            d[(hr1, hr2, hb1, hb2)] += 1
        else:
            d[(hr1, hr2, hb1, hb2)] = 1
        return
    elif i == n and k == 1:
        hr1, hb1 = 0, 0
        hr2, hb2 = 0, 0
        cntr, cntb = 0, 0
        for j in range(n):
            if c[j]:
                hr1 += y[j] * powb1[cntr]
                hr2 += y[j] * powb2[cntr]
                hr1 %= mod
                hr2 %= mod
                cntr += 1
            else:
                hb1 += y[j] * powb1[cntb]
                hb2 += y[j] * powb2[cntb]
                hb1 %= mod
                hb2 %= mod
                cntb += 1
        if min(cntr, cntb) == 0:
            return
        if (hr1, hr2, hb1, hb2) in d:
            global ans
            ans += d[(hr1, hr2, hb1, hb2)]
        return
    c[i] = 1
    f(i + 1, k)
    c[i] = 0
    f(i + 1, k)


n = int(eval(input()))
s = list(eval(input()))
mod = pow(2, 31) - 1
b1, b2 = 27, 31
powb1 = [pow(27, i, mod) for i in range(n)]
powb2 = [pow(31, i, mod) for i in range(n)]
d = {}
x, y = [], []
for i in range(n):
    x.append(ord(s[i]) - 96)
    y.append(ord(s[-(i + 1)]) - 96)
ans = 0 if not x == y else 2
c = [0] * n
f(0, 0)
c = [0] * n
f(0, 1)
print(ans)

def f(i, k):
    if i == n and k == 0:
        global d
        hr1, hb1 = 0, 0
        hr2, hb2 = 0, 0
        cntr, cntb = 0, 0
        for j in range(n):
            if c[j]:
                hr1 += x[j] * powb1[cntr]
                hr2 += x[j] * powb2[cntr]
                hr1 %= mod
                hr2 %= mod
                cntr += 1
            else:
                hb1 += x[j] * powb1[cntb]
                hb2 += x[j] * powb2[cntb]
                hb1 %= mod
                hb2 %= mod
                cntb += 1
        if min(cntr, cntb) == 0:
            return
        if (hr1, hr2, hb1, hb2) in d:
            d[(hr1, hr2, hb1, hb2)] += 1
        else:
            d[(hr1, hr2, hb1, hb2)] = 1
        return
    elif i == n and k == 1:
        hr1, hb1 = 0, 0
        hr2, hb2 = 0, 0
        cntr, cntb = 0, 0
        for j in range(n):
            if c[j]:
                hr1 += y[j] * powb1[cntr]
                hr2 += y[j] * powb2[cntr]
                hr1 %= mod
                hr2 %= mod
                cntr += 1
            else:
                hb1 += y[j] * powb1[cntb]
                hb2 += y[j] * powb2[cntb]
                hb1 %= mod
                hb2 %= mod
                cntb += 1
        if min(cntr, cntb) == 0:
            return
        if (hr1, hr2, hb1, hb2) in d:
            global ans
            ans += d[(hr1, hr2, hb1, hb2)]
        return
    c[i] = 1
    f(i + 1, k)
    c[i] = 0
    f(i + 1, k)


n = int(eval(input()))
s = list(eval(input()))
mod = pow(2, 31) - 1
b1, b2 = 27, 31
powb1 = [pow(27, i, mod) for i in range(n)]
powb2 = [pow(31, i, mod) for i in range(n)]
d = {}
x, y = [], []
for i in range(n):
    x.append(ord(s[i]) - 96)
    y.append(ord(s[-(i + 1)]) - 96)
ans = 0 if not x == y else 2
c = [0] * n
f(0, 0)
c = [0] * n
f(0, 1)
print(ans)

-                hr1 += x[j] * pow(b1, cntr, mod) -                hr2 += x[j] * pow(b2, cntr, mod) +                hr1 += x[j] * powb1[cntr] +                hr2 += x[j] * powb2[cntr] -                hb1 += x[j] * pow(b1, cntb, mod) -                hb2 += x[j] * pow(b2, cntb, mod) +                hb1 += x[j] * powb1[cntb] +                hb2 += x[j] * powb2[cntb]