import Data.List

main = do
  _ <- getLine
  s <- getLine
  print $ solve s

solve :: String -> Int
solve s = mod answer (10^9+7) where
 answer = calc (subsequences s) - 1

calc ::[[Char]] -> Int
calc [] = 0
calc (x:xs)
 | convert x == 0 = 1 + calc xs
 | otherwise = calc xs

convert ::String -> Int
convert x = length x - length(nub x)
