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

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

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

comb :: Int -> [a] -> [[a]]
comb _ [] = []
comb 1 xs = [[x] | x <- 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 (nub xss)
