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

powerproduct :: [Int] -> [Int]
powerproduct [] = [1]
powerproduct (x : xs) = [x * ps `mod` (10 ^ 9 + 7) | ps <- powerproduct xs] ++ powerproduct xs

sum' :: [Int] -> Int -> Int
sum' [] s = s
sum' (x : xs) s = sum' xs ((x + s) `mod` (10 ^ 9 + 7))

main = do
  n <- getInt
  [s] <- getString
  let s' = map length (group (sort s))
  print $ sum' (powerproduct s') (-1)
