local mfl = math.floor
local n = io.read("*n", "*l")
local s = io.read()
local tot = 1
for i = 1, n do
  tot = tot * 2
end
local first_str_by_ruse = {}
for i = 0, n do
  first_str_by_ruse[i] = {}
end
for i = 0, tot - 1 do
  local left = 1
  local right = n
  local t = {}
  for j = 1, n do
    t[j] = 0
  end
  local ruse = 0
  for j = 1, n do
    if i % 2 == 0 then
      t[left] = s:sub(j, j)
      ruse = ruse + 1
      left = left + 1
    else
      t[right] = s:sub(j, j)
      right = right - 1
    end
    i = mfl(i / 2)
  end
  local str = table.concat(t)
  if first_str_by_ruse[ruse][str] then
    first_str_by_ruse[ruse][str] = first_str_by_ruse[ruse][str] + 1
  else
    first_str_by_ruse[ruse][str] = 1
  end
end
local ret = 0
for i = 0, tot - 1 do
  local left = 1
  local right = n
  local t = {}
  for j = 1, n do
    t[j] = 0
  end
  local ruse = 0
  for j = n, 1, -1 do
    if i % 2 == 0 then
      t[left] = s:sub(j + n, j + n)
      ruse = ruse + 1
      left = left + 1
    else
      t[right] = s:sub(j + n, j + n)
      right = right - 1
    end
    i = mfl(i / 2)
  end
  local str = table.concat(t)
  if first_str_by_ruse[ruse][str] then
    ret = ret + first_str_by_ruse[ruse][str]
  end
end
print(ret)
