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

ttl = 2**n - 1

hash = Hash.new(0)
s.each_with_object(hash){|v,o| o[v]+=1}
vs = hash.values.map { |i| (i > 1) ? i : nil }.compact

mns = vs.map{|i| 2**(n-i) }.inject(:+)
pls = 0
2.upto(vs.size) do |v|
  vs.combination(v).to_a.each do |a|
    pls += 2**(n-(a.inject(:+)))
  end
end

p (ttl - mns.to_i + pls.to_i) % 1000000007