import Data.List (tails)

main :: IO ()
main = do
  _ <- getLine
  s <- getLine
  print $ (ans s) `mod` (10^9+7)

ans :: String -> Int
ans str = subseq str' - 1 where
  str' = ' ' : str
  subseq [s] = 1
  subseq (s:sx) = let sx' = filter (/= s) sx
                  in 1 + (sum $ zipWith (\t ts -> subseq (t:ts)) sx' (tail $ tails sx'))