import Data.List
main = do
  _ <- getLine
  s <- getLine
  print $ (length $ tail $ f s) `mod` 1000000007

f [a,b] = [[],[a],[b],[a,b]]
f (q:qs) = filter (\x -> length x == length (nub x)) (f qs) ++  filter (\x -> length x == length (nub x)) (map (++[q]) (f qs))
