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

readInt = fst . fromJust . BS.readInt
readString = map BS.unpack . BS.words

getInt = readInt <$> BS.getLine
getString = readString <$> BS.getLine

ordNub :: Ord a => [a] -> [a]
ordNub xs = foldr (\x k s -> if Set.member x s
  then k s
  else x : k (Set.insert x s))
  (const []) xs Set.empty

comb :: Int -> String -> [String]
comb _ [] = []
comb 1 xs = [[x] | x <- (ordNub xs)]
comb n (x : xs) = [x : y | y <- comb (n -1) xs] ++ comb n xs

main = do
  n <- getInt
  [s] <- getString
  let xss = comb 3 s
  print $ length (ordNub xss)
