n=gets.chomp.to_i
s=gets.chomp.split("")

result = []
1.upto(2**n) do |i|
  tmp = []
  i.to_s(2).rjust(n, '0').split("").each_with_index do |o, idx|
    tmp << s[idx] if o == "1"
  end
  result << tmp.join() if tmp.size == tmp.uniq.size
end

p (result.size-1) % 1000000007