import Data.List (sort, foldl', group)

main :: IO ()
main = do
  getLine
  s <- getLine
  let
    s' = map (toInteger . length) . group . sort $ s
    c = foldl' step 1 s' - 1
    step a i = mod (a * (i + 1)) d
  print c

d :: Integer
d = 10 ^ 9 + 7
