import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe

readInt = fromIntegral . fst . fromJust . BS.readInteger

readString = map BS.unpack . BS.words

getInt = readInt <$> BS.getLine

getString = readString <$> BS.getLine

powerset :: [a] -> [[a]]
powerset [] = [[]]
powerset (x:xs) = [x:ps | ps <- powerset xs] ++ powerset xs

product' :: [Int] -> Int -> Int
product' [] p = p
product' (x : xs) p = product' xs (x * p `mod` (10 ^ 9 + 7))

calc :: [[Int]] -> Int -> Int
calc [] n = n
calc (p : ps) n = calc ps (((product' p 1) + n) `mod` (10 ^ 9 + 7))

main = do
  n <- getInt
  [s] <- getString
  let s' = map length (group (sort s))
  let ps = powerset s'
  print $ calc (init ps) 0
